Linux:How to compile php with mysqli support

While installing php from source with mysqli support could be big trouble , Most of the time it through bellow errors

configure: error: Cannot find libmysqlclient under /usr.

if you see this kind of error, try to find out where is libmysqlclient into your server, by typing

locate libmysqlclient

you might see output like this :


Resolution is to tell php where is your lib directory is ,
for a 64 bit server, its /usr/lib64. so configure your php like bellow

 ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/var/lib/mysql --with-libdir=/lib64 --with-mysqli --enable-mbstring --with-gd --with-zlib --with-jpeg-dir --with-png-dir --with-openssl --with-curl --with-mcrypt --with-imap --with-kerberos --with-imap-ssl

Hope this will help.

How to compile php for GD library

Install necessary software by yum or from source

yum install gd gd-devel yum install zlib zlib-devel


a) Download the php source from here :
b) Download the source file in to /tmp directory
c) Here I am gussing the php version is php-5.3.0.tar.gz
d) Tar –xvzf php-5.3.0.tar.gz
e) Cd php-5.3.0

 ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring –-with-gd –-with-zlib –-with-jpeg-dir-with-png-dir

g) make
h) make install
i) setup your php.ini : cp php.ini-dist /usr/local/lib/php.ini
j) Stop apache /usr/local/apache/bin/apachectl1 stop
k) Restart apache /usr/local/apache/bin/apachectl1 start

How to check :

create a file phpinfo.php


Open the file in your browser , http://localhost/phpinfo.php

and Look for 2 section , GD and ZLIB. You should see something like bellow pictures