Cron job not working Ubuntu Lemp stack

July 19, 2015 1.9k views
LEMP Linux Commands PHP DigitalOcean Ubuntu

I have a problem getting a cron job to work with my Lemp stack.
I have a tracker installed (CPVLab) that requires two php scripts run with cron jobs.
One appears to be working with wget and url to php script. I can see start and finished entries in CPVLab error log.
I tried running the other cron job with wget but it starts and never finishes then gives php errors.,
I am now trying this syntax:
*/15 * * * * php -f /var/www/mysite.com/htdocs/cron-wurfl.php
This gives the same problem, starts then does not finish.
CPVLab is encoded with ioncube but maybe that's not the issue here.
Advice much appreciated.

  • Does running the command manually work? php -f /var/www/mysite.com/htdocs/cron-wurfl.php

  • Thanks for reply
    Hmm interesting...when I paste the command manually in a terminal I get an ioncube loaders error.
    My php.info says that ioncube is installed but clearly there is an error somewhere.

  • @zx1905cc I'm guessing that the ioncube loader extension is configured for php5-fpm/mod_php but not the cli version of PHP. You'll need to copy the ioncube.ini file from /etc/php5/apache2/conf.d/ to /etc/php5/cli/conf.d/.

  • Thanks for reply

    /etc/php5/ " apache2 not at this location"
    and /etc/php5/cli/conf.d/. does not contain an ioncube.ini file
    I built the Lemp stack using "easy engine" is the file structure different?
    Learning as I go here!

  • @zx1905cc Oh, a LEMP stack uses php5-fpm so you'll find the ini file in /etc/php5/fpm/conf.d.

  • Thanks so much for your help.
    Found the .ini file but was located in /etc/php5/fpm
    I should copy to: /etc/php5/cli/conf.d/

  • Copied the ini file as suggested now works.. thank you!

1 Answer

Try using the full PHP CLI path,

 */15 * * * * php -f /var/www/mysite.com/htdocs/cron-wurfl.php

Also this Q&A might have a solution - https://www.digitalocean.com/community/questions/cronjob-not-running-on-ubuntu-server?answer=22492

  • Thanks for reply
    Q+A was interesting but dont have the same error..seems I am not alone with CPVLab problems.

Have another answer? Share your knowledge.