kristo5747 Posted November 16, 2010 Share Posted November 16, 2010 Gurus, I have coded for my client a PHP script that performs some extensive data munging on text files he creates. Code is complete and I have now to automate the script. Problem is that it seems to *only* run manually. I won't run as CRON job. This is what I have tried with "#!/usr/bin/php -q" in the header of my script: 00 1 * * * /usr/bin/php -q /HDDLogs/HDDProcess.php >>/HDDLogs/HDDProcess.log 2>&1 The log file does get created but is empty. I tried removing the -q for quiet mode: no difference. Still did not run. Apache 2.0 and PHP 5.3 is installed on this server. I fully own the directory with my code and the data files are located. Any idea?? Thanks, Al. Quote Link to comment Share on other sites More sharing options...
thehippy Posted November 16, 2010 Share Posted November 16, 2010 Are you running this as root? root's crontab has an extra field to designate a user to run as minute hour monthday month weekday user command Quote Link to comment Share on other sites More sharing options...
kristo5747 Posted November 16, 2010 Author Share Posted November 16, 2010 No, not root. The userid I have runs CRON-ed bash scripts as well without problems. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 16, 2010 Share Posted November 16, 2010 is the script chmod 755? Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted November 16, 2010 Share Posted November 16, 2010 Do you have this at the top of your script? error_reporting(E_ALL); ini_set('display_errors', '1'); Quote Link to comment Share on other sites More sharing options...
thehippy Posted November 16, 2010 Share Posted November 16, 2010 try php -f /HDDLogs/HDDProcess.php Is cron logging enabled? probably piping to syslog if it is. Does syslog show a successful run? Your script doesn't rely on any environment variables does it? cron's execution wont load up any of your shell variables from .login, .bash, etc. /usr/bin/php is php-cli, yes? though I dont think it should make a difference in this situation ... I'm running out of ideas Quote Link to comment Share on other sites More sharing options...
kristo5747 Posted November 16, 2010 Author Share Posted November 16, 2010 I am officially a moron. I had 2 includes (in a \lib directory) in my script. CRON did not known anything about these, thereby explaining why my script never ran. I created a bash script wrapper that navigates into that directory before launching the script. It works now. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted November 17, 2010 Share Posted November 17, 2010 I am officially a moron. I had 2 includes (in a \lib directory) in my script. CRON did not known anything about these, thereby explaining why my script never ran. I created a bash script wrapper that navigates into that directory before launching the script. It works now. That was my gut feeling, that's what error reporting would have told you Also, rather than a bash script you can use absolute path names for the includes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.