Running PHP scripts from command-line with WAMP (Windows Apache, MySQL, PHP)
On my old pc I installed Apache, MySQL and PHP singularly, and I made some PHP scripts to be runned from command-line, like this:
c:\php\php -f myscript.phpOn my new pc I installed WAMP5 1.6.4, all was running fine (phpMyAdmin, my local website, php scripts pointed to by the browser) but php scripts launched by command-line reported
Fatal error: Call to undefined function mysql_connect() in myscript.phpObviously I changed the php path to
c:\wamp\php\phpbut with no results.
Solution: change the command to
c:\wamp\php\php -c c:\wamp\apache2\bin -f myscript.phpThe -c option tells php to search php.ini in the directory specified, and that's needed because WAMP puts php.ini in Apache bin directory, while with a PHP regular installation php.ini is located in the php.exe directory.