Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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
share|improve this answer
    
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" –  matt74tm Oct 16 '10 at 11:40
    
test php: php -r 'mysql_connect();' –  bindbn Oct 16 '10 at 12:18
    
PHP Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in Command line code on line 1 –  matt74tm Oct 16 '10 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. –  matt74tm Oct 16 '10 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 '10 at 19:53
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.