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
My system is CentOS. In my case, the the path to mysql.so is incorrect.
When I type
php -m
There is no mysql.
In my original /etc/php.d/mysql.ini there is only one line:
extension=mysql.so
So I use command:
rpm -ql php-mysql | grep mysql.so
to find out the correct path, which is
/usr/lib64/php/modules/mysql.so
then I replaced the line to :
extension=/usr/lib64/php/modules/mysql.so
then
service httpd restart
and
php -m
mysql is now loaded.