Question

Cron job gives permission error on execution

I am running a tracker (CPVLab) hosted on a Lemp Stack The site works fine but there is a problem with a cron job. When the cron job executes I get an error:

2015/08/01 07:00:04 [error] 1303#0: *605 FastCGI sent in stderr: “PHP message: PHP Warning: unlink(/var/www/mysite.com/htdocs/WURFLres//storage/cache/1/3/dfe45504453a9fc3d1ff7a090cd225): Permission denied in /var/www/mysite.com/htdocs/WURFL/Storage/File.php on line 0” while reading response header from upstream, client: 46.101.44.xxx, server: mysite.com, request: “GET /cron-wurfl.php HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “mysite.com

I set up the cron job using crontab -e as root, no other errors present but I did have issues with ionCube leaders to start with. Can anyone help please. Thanks.

Show comments

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

BINGO problem solved! Thanks for the answers, much appreciated

Are you using wget to request the file on crontab?

If so it doesn’t matter if cron is setup as root or any other user as it is Nginx and PHP-FPM executing the file as the web user.

Try changing the ownership of the whole directory:

chown -R www-data:www-data /var/www/mysite.com/htdocs