2011年4月23日土曜日

Execute a Php Script from command-line

I have a php script that searches information from search-engines and saves the data into database server. I can excecute it from browser but can not excecute it from command-line by using "php script_name.php"
After typing "php -m",I know that php-mysql module is not loaded.
The server is hosting for some important sites. So it's dangerous if i make an updating or new installation.
Because the script can be executed from browser , so wget is a good solution.
My shell_script will be like this :

#!/bin/sh
wget --delete-after php_script_link -q


-q : quiet mode, do not display the output of script.
--delete-after means the log file will be deleted after the process finish.

******** You should use the absolute path of Php Script link ***************