Compile and install php5.4.0 in centos5.4

Source: Internet
Author: User
Tags imagemagick mcrypt
1. Download related programs

Wget http://cn.php.net/distributions/php-5.4.0.tar.gz

Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

Wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz

Wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz

Wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz

Wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.5-9.tar.gz

Wget http://pecl.php.net/get/imagick-3.0.1.tgz

2. Compile and install the support libraries required for PHP 5.4.0


Tar zxvf libiconv-1.14.tar.gz & CD libiconv-1.14
./Configure -- prefix =/usr/local
Make & make install & CD ..

Tar zxvf libmcrypt-2.5.8.tar.gz & CD libmcrypt-2.5.8
./Configure
Make & make install
/Sbin/ldconfig

CD libltdl/
./Configure -- enable-ltdl-install
Make & make install & CD ../../

Tar zxvf mhash-0.9.9.9.tar.gz & mhash-0.9.9.9/CD/
./Configure
Make & make install & CD ..

Ln-S/usr/local/lib/libmcrypt. La/usr/lib/libmcrypt. La
Ln-S/usr/local/lib/libmcrypt. So/usr/lib/libmcrypt. So
Ln-S/usr/local/lib/libmcrypt. so.4/usr/lib/libmcrypt. so.4
Ln-S/usr/local/lib/libmcrypt. so.4.4.8/usr/lib/libmcrypt. so.4.4.8
Ln-S/usr/local/lib/libmhash. A/usr/lib/libmhash.
Ln-S/usr/local/lib/libmhash. La/usr/lib/libmhash. La
Ln-S/usr/local/lib/libmhash. So/usr/lib/libmhash. So
Ln-S/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2
Ln-S/usr/local/lib/libmhash. so.2.0.1/usr/lib/libmhash. so.2.0.1
Ln-S/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config

Tar zxvf mcrypt-2.6.8.tar.gz & mcrypt-2.6.8/CD/
/Sbin/ldconfig
./Configure
Make & make install & CD ..

3. Compile PHP

Install dependency packages

Yum install ncurses-devel libxml2-devel bzip2-devel libcurl-devel \
Curl-devel libjpeg-devel libpng-devel FreeType-devel net-snmp-devel

Tar xvzf php-5.4.0.tar.gz & CD php-5.4.0

./Configure -- prefix =/usr/local/php5.4.0 -- With-config-file-Path =/usr -- With-iconv-Dir =/usr/local -- enable-FPM \
-- Disable-phar -- With-FPM-user = www-data -- With-FPM-group = www-data -- With-PCRE-RegEx \
-- With-zlib -- with-bz2 -- enable-calendar -- With-curl -- enable-DBA -- With-libxml-Dir \
-- Enable-FTP -- With-Gd -- With-JPEG-dir -- With-PNG-dir -- With-zlib-dir -- With-FreeType-Dir \
-- Enable-Gd-native-TTF -- enable-Gd-JIS-Conv -- With-mhash -- enable-mbstring -- With-mcrypt \
-- Enable-pcntl -- enable-XML -- disable-rpath -- enable-shmop -- enable-sockets -- enable-zip \
-- Enable-bcmath -- With-SNMP -- disable-ipv6 -- with-apxs2 =/usr/sbin/apxs

Make zend_extra_libs = '-liconv'

Make Test

Make install

Cp php. ini-production/usr/local/php5.4.0/etc/PHP. ini

4. Compile and install the PhP5 extension module


VI/usr/local/php5.4.0/etc/PHP. ini

Add at the end of the file:

Extension_dir =/usr/local/php5.4.0/lib/PHP/extensions/no-debug-non-zts-20090626/
Extension = "memcache. So"
Extension = "memcached. So"
Extension = "imagick. So"

Modify the parameters in the file as follows:
CGI. fix_pathinfo = 0 // The original value is 1
Open_basedir =/tmp:/www/Web // originally commented
Expose_php = off // The original value is on
Allow_url_fopen = off // The original value is on
Disable_functions = phpinfo, passthru, ini_restore, Eval // The original value is null.

5. Execution 

Echo "/usr/local/PHP/sbin/PHP-FPM start">/etc/rc. Local

6. Start

Apache: Service httpd start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.