Issues with CRON job executing on Ubuntu 20.04 with PHP 7.4 FPM

I am having issues properly setting up the following CRON job to automate backups on my client’s website.

The site is Joomla-based and I am using Akeeba Backup to handle the backups. The recommendations for the command-line CRON jobs are as follows:

Use the following command in your host’s CRON interface: /path/to/php /var/www/

Remember to substitute /path/to/php with the real path to your host’s PHP CLI (Command Line Interface) executable. Do remember that you must use the PHP CLI executable; the PHP CGI (Common Gateway Interface) executable will not work with our CRON scripts. If unsure what this means, please consult your host. They are the only people who can provide this information. used as an example

I have CRON installed and running on Ubuntu 20.04.

The following code is in crontab -e

0 3 * * * /usr/bin/php7.4 /var/www/ --profile=1 --description="Full automated backup"

The site is running PHP 7.4 with FPM installed.

When I run which php the following is returned: /usr/bin/php

When I run ls -l /usr/bin/php the following is returned: lrwxrwxrwx 1 root root 21 Aug 31 18:09 /usr/bin/php -> /etc/alternatives/php

When I run ls -l /etc/alternatives/php the following is returned: lrwxrwxrwx 1 root root 15 Aug 31 18:53 /etc/alternatives/php -> /usr/bin/php8.0

As this shows version 8.0 instead of 7.4, which the site is using, does this mean the CRON job should be using version 8 instead.

Sample log output from /var/log/syslog

Oct 1 11:39:01 domain CRON[38538]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)

Any help is greatly appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 3, 2021
Accepted Answer


As the website uses PHP 7.4, I believe that it is best to run the cronjob with PHP 7.4 as well for consistency.

To check if this /usr/bin/php7.4 is the correct path to the PHP 7.4 executable, you could run the following command:

/usr/bin/php7.4 -v

If the output indicates that the PHP version is 7.4, then I could suggest running the command manually:

/usr/bin/php7.4 /var/www/ --profile=1 --description="Full automated backup"

That way you will be able to see if there are any errors when the command is executed.

If you get any errors feel free to share them here after removing any sensitive information from the output.

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel