Monday, August 3, 2009

With a GoDaddy Virtual server, how do I get a crontab job to execute a PHP script on one of my hoste

I know how to setup a crontab job, but when I schedule a PHP job it never runs.



With a GoDaddy Virtual server, how do I get a crontab job to execute a PHP script on one of my hosted domains?





You need to verify that GoDaddy%26#039;s PHP installation includes a command-line interpreter. If it does, its location must be referenced within the script, for example:



#!/usr/bin/php



%26lt;?php



// script starts here



?%26gt;



Alternatively, the interpreter must be called explicitly in the command line, for example:



/usr/bin/php myscript.php



If there is no command-line interpreter on the system, you need to call a command-line browsing utility such as lynx or wget, which would activate your script via HTTP.



With a GoDaddy Virtual server, how do I get a crontab job to execute a PHP script on one of my hosted domains?



You cant execute a php script by calling itself because the php runs from within the web server!



Your best option is to set up cron to run



%26quot;lynx - source http://youraddress/yourphp.php%26quot;



lynx is a command line web browser which most linux systems have installed by default!

No comments:

Post a Comment