So I wasn't sure if this question would go best here or on Overflow or Server Fault, but decided to try here first. I'm installing LAMP on a VPS, and am running into issues configuring and building PHP. I've got MySQL installed, and it seems to be running fine. I'm trying to just go for a basic install of PHP with MySQL support as instructions are given here:


Here's the configure command I was running:

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql 

I was getting this error:

configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

I just had a basic, default MySQL install with yum install mysql-server mysql.

After some Googling, I installed mysql-devel to get rid of that error:

yum install mysql-devel 

Then I started getting this error:

configure: error: Try adding –with-zlib-dir=<DIR>. Please check config.log for more   information. 

Okay. So I changed my command to:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib

Now I just get this:

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

Honestly kind of lost at this point. I'm looking at the config.log, but not exactly sure what I need to be looking for. Here's the sections I think may be relevant:

configure:60061: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden-Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib  conftest.c -lmysqlclient  -lz -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 60050 "configure"
#include "confdefs.h"

Any thoughts? Or should I be looking at something else in config.log?

3 Answers 3


I recommend looking for binary packages for your distribution.

If you want to stick with building from source, I recommend that you start from a pristine source when you've installed new libraries. The configure program keeps a cache of what it's found, and sometimes won't realize that the cache is no longer up-to-date. If configure has finished running and produced a Makefile, then run make distclean. Otherwise, if PHP isn't doing anything too exotic, rm config.cache config.status should do the trick.


The manual you are following is bit complex. I suggest you following Linode Guide on LAMP stack. Follow the steps one by one (it will hardly take 20 minutes) and you are done.

NOTE: If you are planning to run some open source apps then skip Suhosin (php5-suhosin) package for now. It gave problem with Wordpress on Linode.

  • Yay, got it all working with that guide! Just put up my first page on the VPS using mysql_connect to prove it. Thanks for the help.
    – Nate
    Nov 4, 2011 at 0:43

If you have installed MySQL from source you would also have to install/compile mysql-connector so that PHP can find the required header files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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