1. Install dependent files:
Yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-deve L zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs E2 Fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap openldap-devel Nss_ldap Openldap-clients openldap-servers gd gd2 gd-devel gd2-devel Perl-cpan pcre-devel
2. Download the PHP source code:
wget http://us3.php.net/get/php-5.5.20.tar.gz/from/cn2.php.net/mirror
tar -xvf php-5.5.20.tar.gz
cd php-5.5.20
3. Error cases:configure: error: mcrypt.h not found. Please reinstall libmcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7
./configure prefix=/usr/local/libmcrypt/
4. Compile and install:
./configure--prefix=/usr/local/php--with-config-file-path=/etc/php--enable-fpm--enable-pcntl--enable-mysqlnd-- Enable-opcache--enable-sockets--enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-shmop--enable-zip-- Enable-ftp--enable-soap--enable-xml--enable-mbstring--disable-rpath--disable-debug--disable-fileinfo-- With-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-pcre-regex--with-iconv--with-zlib-- With-mcrypt--with-gd--with-openssl--with-mhash--with-xmlrpc--with-curl--with-imap-ssl
Make
Make Install
CP php.ini-development/etc/php/
5. Add Environment variables:
Vi/etc/profile
Path=/usr/local/php/bin: $PATH
Export PATH (added at the end)
Linux under compile and install PHP