Centos – How to compile PHP Version 5.2.13 with zip support on CentOS

centoscompressionPHPvps

Hi i am having a big problem, i have a vps with centos installed on it.
But i have a script which needs php zip library i checked on php.net it says
"In order to use these functions you must compile PHP with zip support by using the –enable-zip configure option." i have PHP Version 5.2, Please Guide me how am i going to do that??

Best Answer

At command line:

wget [link to php goes here]
tar -xvf [file you downloaded goes here]
cd [name of file without the extension\folder that was just extracted to]
./configure --enable-zip
make
make install

In convenient batch form that you should be able to copy and paste:

yum install -y make wget gcc zip-devel bzip2-devel
wget http://us3.php.net/get/php-5.2.14.tar.gz/from/this/mirror
tar -xvf php-5.2.14.tar.gz
cd php-5.2.14
./configure --enable-zip
make
make install

If the configure fails....

The configure may fail - if it does you most like need the devel library of what is missing (look at the output.) If it is bzip for example you would use the command

yum install bzip-devel

In your case it might be something like

yum install zip-devel

This should give you an idea of what you need if the above does not work.

yum search zip 

After doing this simply continue at the configure step above that failed (if it fails the first itme through).