Archive for the ‘php’ Category

Linux:How to compile php with mysqli support

Thursday, December 23rd, 2010

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 :

/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.la
/usr/lib64/mysql/libmysqlclient_r.a
/usr/lib64/mysql/libmysqlclient_r.la

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

Friday, November 13th, 2009

Install necessary software by yum or from source

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

then

a) Download the php source from here : http://www.php.net/downloads.php
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
f)

 ./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

<?php
phpinfo();
?>

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