I have a Debian 7. 3 Server with WebMin installed. I configured a cron job to run every minute as root user, so I run the command crontab -l when I'm logged in as root it shows:

* * * * * /usr/bin/php -q /home/myfolder/cron.php

The permissions of that file are the following:

-rwxr--r-- 1 root root 1617 Jan 18 15:17 /home/myfolder/cron.php

When I go to the cron.log file in /var/log folder I see this error repeated every minute:

Apr 16 12:25:01 ns3313699 CRON[25370]: Permission denied

the result of the command ls -ld /usr/bin/php /home/myfolder is:

drwxrwxr-x 20 myfolder www-data 4096 Apr 16 11:43 /home/myfolder
lrwxrwxrwx 1 root root 21 Jan 18 11:05 /usr/bin/php -> /etc/alternatives/php
  • 1
    Change your cron command to /home/myfolder/cron.php 2> /home/myfolder/errror. That will save any errors printed to /home/myfolder/errror. Please edit your question and add those errors. – terdon Apr 16 '14 at 10:50
  • Done, but I cannot see ant errror file in /home/myfolder – Luca Coppola Apr 16 '14 at 10:54
  • 1
    @LucaCoppola - what's the file cron.php attempting to do? To confirm I'd try a simple cron first using Bash, and make sure that this "hello cron" script works and then work your way up. – slm Apr 16 '14 at 12:52
  • 3
    This message is from cron, not from PHP. What are the permissions on the crontab file? – Gilles 'SO- stop being evil' Apr 16 '14 at 22:17
  • 1
    @derobert Thus it makes a lot of sense to start with strace -f -e trace=open -p $pidofcron or strace -f -e trace=file -p $pidofcron – Hauke Laging Apr 25 '14 at 2:10

Browse other questions tagged or ask your own question.