0

I've got PHp installed from my hosting provider and it doesnt seem to have mysql support built in. I was redirected to an installation script:

/usr/bin/mysql_secure_installation

Which installed mysql as a program, but phpinfo() still shows:

Configure Command './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' .............................. '--without-mysql' '

What do I do next to have mysql support?

1 Answer 1

1

Install php-mysql:

yum install php-mysql

Then check /etc/php.d/mysql.ini file. Tets php:

php -i | grep -i mysql
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo_mysql.ini,
MySQL Support => enabled
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /var/lib/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib/mysql -lmysqlclient 

php -r 'mysql_connect();'
PHP Warning:  mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in Command line code on line 1
6
  • Interesting - this sort of installed something, but no change in phpinfo() and no change in my application - "Installed: php-mysql.x86_64 0:5.1.6-27.el5 Dependency Installed: php-pdo.x86_64 0:5.1.6-27.el5"
    – siliconpi
    Oct 16, 2010 at 11:40
  • test php: php -r 'mysql_connect();'
    – bindbn
    Oct 16, 2010 at 12:18
  • PHP Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in Command line code on line 1
    – siliconpi
    Oct 16, 2010 at 12:35
  • I dont know if it complicates things, but my root password is X, my mysql admin password is Y and the password for the database user for my applicaiton is Z.
    – siliconpi
    Oct 16, 2010 at 12:38
  • @matt_tm - that error means you've got your mysql support working. Otherwise you'd get some version of a "method not found" error. You can sort out the authentication issues in your php code.
    – Brad Mace
    Oct 17, 2010 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .