PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a php application which successfully connects to mysql and interacts with the database.
I am using apache as my web server.
I would like to invoke my code from the command shell, using php.exe like so:
c:\php\php.exe c:\script.php
in script.php I am using mysql_connect to connect to the database.
I get the following error:
Access denied for user 'root'@'localhost' (using password: YES)
Note that the same script is working perfectly when invoked via the web server...
what do I need to do in order to make my script work from the command line?
I found the problem.
the fact that the code was involed from the command line, caused some of the global parameters in $_SERVER not to be initialized properly, and that caused me to attempt to connect to the database using the wrong password.