Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
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:
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.
domain.com used as an example
I have CRON installed and running on Ubuntu 20.04.
The following code is in
0 3 * * * /usr/bin/php7.4 /var/www/domain.com/cli/akeeba-backup.php --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:
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
Oct 1 11:39:01 domain CRON: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Any help is greatly appreciated.
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.×