Alex Rivera | Logout

PHP: mysql_connect() won't work via command line

Asked 2008-10-08T03:25:37.350
12

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 I receive the following error:

Call to undefined function mysql_connect()

This seems completely paradoxical. Anyone have any ideas as how I can run it from the command line. Btw, I run it from a bash shell like so:

php /path/to/script.php
Edit
Report

1 Answer

1

Please make sure this line appears in php.ini

extension=php_mysql.dll

Please note that the php.ini used in command line may be different from the php.ini used by apache.

answered 2008-10-08T08:47:03.347

Your Answer