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

I am attempting to get MySQL working in PHP on CentOS with Apache that was installed from source by some one else. PHP was also installed from source so yum install php-mysql doesnt work though it does work for CLI PHP but thats not the php apache is using. I have downloaded the new source for php and installed it to replace the old php. My config command was

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-MySQL=/usr/local/mysql --prefix=/usr/local/php --with-config-file-path=/usr/local/php --disable-cgi --with-zlib --with-gettext --with-gdbm

At this point I cant get any mysql code to work and phpinfo() does not show info for MySQL but it does show the above configure command. It maybe something I need to change in my php.ini. Alternatively if I can just use php installed with yum that would work. Just it would need to know php is installed at /usr/local/apache/ or that I need the libphp5.so module for the yum installed php and not the one compiled from source.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Which version of PHP? If 5.3 or higher, you could try:

--with-mysql=mysqlnd

That's the mysql native driver that php started using in php 5.3

Also, in case you haven't, browse through the installation instructions here if it's not 5.3:

http://www.php.net/manual/en/mysql.installation.php

share|improve this answer
    
Thanks a million, recompiled with that flag and it worked like a charm. –  spetz Jul 22 '11 at 14:50

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.