Page 1 of 1

Why does it works in Command Line but not in Crontab ?

Posted: Fri May 30, 2008 3:05 am
by GeniusTse
I wanna to run a PHP programe periodically, which require more than one hour.

I wrote a programe that will write log for each action it done. and it will write <end> tag whem it done
My program can be run properly in terminal when I triggered it manually using

Code: Select all

/opt/lampp/bin/php -d max_execution_time=3600 /opt/lampp/htdocs/proejct/a.php -d today
And I wrote below on the Crontab,

Code: Select all

0 * * * * /opt/lampp/bin/php -d max_execution_time=3600 /opt/lampp/htdocs/proejct/a.php -d today
but the just wrote a few line of log and stop logging without <end> tag

Why does my program can run properly in Command Line, but not in crontab ???

(I have used ini_set and require_once('Zend/Db.php'), is it the reason that program is not work in crontab ??)

Code: Select all

ini_set("include_path", ini_get('include_path'). PATH_SEPARATOR .dirname(__FILE__));
require_once 'Zend/Console/Getopt.php';

Re: Why does it works in Command Line but not in Crontab ?

Posted: Fri May 30, 2008 5:00 am
by onion2k
Almost certainly a path problem. Check to see if getcwd() is the same for both ways of running it.