Reputation: 690
I need to write a php script that needs to be executed every 10 mins, so I'm going to setup as a cron job like this:
*/10 * * * * /usr/local/bin/php -q /path/to/my/file.php
According to: Running php script as cron job - timeout issues?
there is no timeout for command line script, which means when running cli script set_time_limit doesn't need to be extended
I have a few questions regarding this:
if I run my php using: */10 * * * * /usr/local/bin/php -q /path/to/my/file.php, will file.php become an command line script (which means it won't timeout)?
do I have to add line: #!/usr/bin/php -q inside file.php?
according to: http://www.php.net/manual/en/features.commandline.introduction.php I have to make sure cli is enabled (--enable-cli) so is it mean that if php is running as cgi (ie. fastcgi) or cli is not enabled (--disable-cli) then I can't setup any cron at all?
Please advise.
Upvotes: 1
Views: 4767
Reputation: 889
/usr/local/bin/php
this runs your php file
1) it dont have timeout
2) no
3) if php runs in command line your cron will run.
Upvotes: 2