Saturday, January 29, 2011

How to compile PHP Version 5.2.13 with zip support on CentOS?

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??

  • 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).

    Josh : You need make and wget to run the above....`yum install wget make -y` will make sure you have them.
    SalmanAbbas007 : I tried yum search zip and got many results 2 of them were zip.i386 and zip-devel and both were already installed. Please tell me how to run this configure command on my exisiting php installation i have kloxo admin panel installed :(
    Josh : I don't believe you can run the configure on an existing install. The configure command is a setup procedure for an install from source. The zip-devel is used when the zip option is enabled to compile it into the install.
    Josh : You will need to reinstall PHP from source. You can use the batch script above to do this, replacing the 5.2.14 link with 5.2.13 if you want that specific version instead. If you don't want to do this, I am unsure of any way to enable the options. One other library you want to make sure you have if you install from source for zip support is `zlib-devel`.
    SalmanAbbas007 : ahh so i cant run a configure command on existing installation :(.
    SalmanAbbas007 : Anyway a Big Thaaaaaaaaaaaaaaanks for the Help :)
    Josh : One last thing is if you want to keep your options in the existing PHP installation you can put `` on one of your pages and then navigate to it. It will list all the configurations and modules in that install of PHP. Of note is the ./configure line. You can copy paste this and then append the extra options you want. Theoretically this should give you the same install with the additional enabled modules, and always glad to help :)
    SalmanAbbas007 : Haha thanks again for the help.
    SalmanAbbas007 : But the new problem i have encountered is here http://serverfault.com/questions/178402/how-to-make-changes-to-kloxos-php-installation . if u have worked with kloxo admin panel then u will know the solution. :)
    From Josh

0 comments:

Post a Comment