Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to compile PHP with mysql_pdo on CentOS 6 and I am having just one heck of a time trying to make it happen. Currently I am trying to compile PHP 5.2, but I am going to have to do this for 5.3 as I need to change versions.

Here is the configure command I am using:


I installed MySQL and mysql-devel from a repository and the error I get is below:

configure: error: PDO_MYSQL configure failed. Please check config.log for more information

When I check config.log, the last line I see is:

configure:72788: checking for mysql_query in -lmysqlclient

I have a feeling that I am using the wrong value for the --with-pdo-mysql, but I have tried not giving it a path or telling it to use mysqlnd and I get an error saying it can't find mysql and if I leave it blank, it gives me the same error when I put the path in.

Anyone have any ideas?

EDIT: I have no idea if this is relevant or not, but I found that I have files located at /usr/lib/mysql.

share|improve this question
Have you tried to install mysql-client too? – Peter Apr 24 '12 at 15:12
There is not a package called mysql-client that I am able to see. It looks like CentOS bundles the client into the regular mysql package. – Josh Pennington Apr 24 '12 at 15:24
A few ideas: a) You can try omitting the path entirely (--with-mysql-pdo), or using --with-mysql-pdo=/usr (it is not uncommon to retrieve the need paths from mysql_config - files can be symlinked to /usr/lib and /usr/include if you use an atypical install location) b) in PHP 5.3+ you can (and should) use the native driver instead: --with-pdo-mysql=mysqlnd c) finally, you usually shouldn't have to compile PHP. It is provided in the base repository, with additional modules available from EPEL. – cyberx86 Apr 24 '12 at 23:37
Can you try installing libmysqlclient* and see if this resolves the issue? – Mugurel Nov 29 '15 at 20:00

Try to avoid install software from source it's a bad practice. I'd suggest to install IUS Community repo . After that just install necessary packages

# yum install php53u-pdo.x86_64 php53u-mysql.x86_64
share|improve this answer

Your Answer


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.