Centos – Compiling PHP on CentOS Needs MySQL PDO Configured

centoscentos6MySQLpdoPHP

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:

./configure 
    --with-apxs2 
    --with-mysql 
    --with-mysqli 
    --with-curl 
    -enable-soap 
    -enable-sockets 
    --enable-mbstring 
    --with-gd 
    --with-mcrypt 
    --with-pdo-mysql=/usr/bin/mysql

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 libmysqlclient.so files located at /usr/lib/mysql.

Best Answer

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