Cronjob PHP script not working

I try to run a cronjob every 20 minutes. This works manually:

php /srv/www/mysite.co.uk/public_html/PP/Make_XML.php LONDON 

I tried using "crontab -e" and install it even every 20 minutes with

  */20 * * * * php /srv/www/mysite.co.uk/public_html/PP/Make_XML.php LONDON 

it was saved in /tmp/crontab.0xYhei9m/crontab

And it does not work. What is wrong here?

EDIT:

Current statistics:

*. cron is up and running:

 root 31855 1 0 08:39 ? 00:00:00 /usr/sbin/cron 

*. Running "crontab -l" shows:

* / 20 * * * * / usr / bin / php / srv / www / mysite.co.uk / public_html / PP / Make_XML.php LONDON

And still no. Again, the manual control of the script works just fine.

+7
source share
4 answers

Does the cron daemon work?

+5
source

it was saved in /tmp/crontab.0xYhei9m/crontab

Yes - the file you just edited - its NOT a crond file reads to run tasks. Crontab then read this file, installed the updated crontab in the place where it was looking for it, and informed that it should process the file.

Have you checked it:

  • does crond work?
  • Your uid is allowed to schedule cron jobs (usually via /etc/cron.allow//etc/cron.deny)
  • that the script really is not running cron and is not running due to a permission error?
  • what version of crond are you using $ PATH support and can you find the executable?
+1
source

If it is already connected to the network, try using wget instead of php with a URL instead of a path, i.e.:

* / 20 * * * * * wget http: //YOUR_IP/~YOUR_USER/PATH/Make_XML.php

or

* / 20 * * * * wget http://mysite.co.uk/PP/Make_XML.php

First make sure the url works just by opening it with a browser

Hope this helps!

0
source

Crontab knows nothing about the PATH variable. So use the absolute path to your php (/ usr / bin / php, for example) / You can run the command which php to find your php path

-one
source

All Articles