I have a script which calls mysql_connect()
to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line
It maybe using a default PHP configuration. I have found before that it doesn't use the same php.ini or doesn't use one at all. Therefore some of the extensions won't be enabled.
Do this instead:
php -c /etc/php.ini /path/to/script.php
Where /etc/php.ini
is the path to your ini file. You can find this by doing a phpinfo();