Forum Moderators: coopster

Message Too Old, No Replies

Help! PHP + crontab problem ~

program was suspended expectedly

         

GeniusTse

6:14 am on May 30, 2008 (gmt 0)

10+ Year Member



I am using Ubuntu. I wanna run a PHP program periodically using crontab (The job required more than one hour)

The program run smoothly when I called it manually

%absolute_path%/php -m -q -d max_execution_time=1440 -d memory_limit=512M %program_path%/a.php -d week 

But, it is strange that the program seems to be suspended(terminated) after few mintues it was called.

Why does it terminated when it was triggered by crontab call ONLY?

More info: The program will LOG each action into the log file

eelixduppy

6:30 am on May 30, 2008 (gmt 0)



Hello and Welcome to WebmasterWorld!

Make sure to use all absolute paths within your script that you are using in your cron because it is not running the script from the directory the script is it, so relative paths will not work. If you have any of these anywhere in your script, change them to the full paths and see if that fixes the issue.

GeniusTse

7:04 am on May 30, 2008 (gmt 0)

10+ Year Member



Thanks for your reply eelixduppy ~

Actually, I am using Relative Path, but I have use

ini_set("include_path", ini_get('include_path'). PATH_SEPARATOR .dirname(__FILE__));
require_once ........

and the program can be run in terminal command line with properly:

%absolute_path%/php %program_path%/a.php -d week

Is it means that my progam can be run on crontab when my program could be run in command line mode?

GeniusTse

7:16 am on May 30, 2008 (gmt 0)

10+ Year Member



for more info:
According to my logging file, the program was start running, but seems no responds few mintues later
(My program will keep logging for each action. In crontab, the program wrote few row and then stop without end tag)

eelixduppy

3:48 pm on Jun 3, 2008 (gmt 0)



Not sure. Have you resolved this issue yet?