Install the new PHP version (5.5.20) without affecting the original php version)

Source: Internet
Author: User
Tags gmp mcrypt
Install the new PHP version (5.5.20) without affecting the original php version)
  • Install the dependency package.

    Yum install gcc httpd-devel libxml2-devel openssl-devel pcre-devel bzip2-devel gmp-devel autoconf curl-devel libxslt-devel libpng-devel postgresql-devel sqlite-devel libmemcached-devel gcc-c ++ unixODBC-devel pcre-devel gmp-devel libxslt-devel libjpeg-turbo-devel freetype-devel-y

  • Download the php source code package

    Wget http://cn2.php.net/distributions/php-5.5.20.tar.gz


  • Compile the php source code package

  • Shell # cd/usr/local/src

    Shell # wget http://cn2.php.net/distributions/php-5.5.20.tar.gz

    Shell # tar-zxvf php-5.5.20.tar.gz

    Shell # php-5.5.20 cd

    Shell #. /configure -- prefix =/usr/local/php5520 -- with-config-file-path =/usr/local/php5520/etc -- with-config-file-scan-dir =/ usr/local/php5520/etc/php. d -- with-libdir = lib64 -- disable-debug -- with-pic -- disable-rpath -- without-pear -- with-bz2 -- with-freetype-dir =/usr -- with-png-dir =/usr -- with-xpm-dir =/usr -- enable-gd-native-ttf -- without-gdbm -- with-gettext -- with-gmp -- with-iconv -- with-jpeg -dir =/usr -- with-openssl -- with-pcre-regex =/usr -- with-zlib -- with-layout = GNU -- enable-exif -- enable-ftp -- enable-sockets -- enable-sysvsem -- enable-sysvshm -- enable-sysvmsg -- with-kerberos -- enable-shmop -- enable-calendar -- enable-xml -- without-mysql -- without-gd -- disable-dom -- disable-dba -- without-unixODBC -- disable-pdo -- disable-xmlreader -- disable-xmlwriter -- without-sqlite3 -- disable-phar -- disable-fileinfo -- disable-json -- without-pspell -- disable -wddx -- without-curl -- disable-posix -- disable-sysvmsg -- disable-sysvshm -- disable-sysvsem -- enable-fpm -- with-mysql = shared, mysqlnd -- enable-opcache

    Shell # make & make install


    4. install additional modules (other modules are installed in this mode)

    Shell # cd/usr/local/src/php-5.5.20/ext/bcmath

    Shell #/usr/local/php5520/bin/phpize

    Shell #./configure -- with-php-config =/usr/local/php5520/bin/php-config

    Shell # make (this step shows the generated bcmath. so Path)

    Shell # make install

    Shell # vim/usr/local/php5520/etc/php. d/bcmath. ini

    ######### Add

    Extension = bcmath. so

    ##########


    Shell # cd/usr/local/src/php-5.5.20/ext/gd

    Shell #/usr/local/php5520/bin/phpize

    Shell #. /configure -- with-php-config =/usr/local/php5520/bin/php-config -- with-freetype-dir =/usr/-- with-jpeg-dir =/usr/

    Shell # make & make install

    Shell # vim/usr/local/php5520/etc/php. d/gd. ini

    ######### Add

    Extension = gd. so

    ##########


    Shell # rpm-ivh ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm

    Shell # rpm-ivh ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm

    Shell # cd/usr/local/src/php-5.5.20/ext/mcrypt

    Shell #/usr/local/php5520/bin/phpize

    Shell #./configure -- with-php-config =/usr/local/php5520/bin/php-config

    Shell # make & make install

    Shell # vim/usr/local/php5520/etc/php. d/mcrypt. ini

    ######### Add

    Extension = mcrypt. so

    ##########


    # Php Cache module, which improves performance

    Shell # cd/usr/local/src/php-5.5.20/ext/opcache

    Shell #/usr/local/php5520/bin/phpize

    Shell #./configure -- with-php-config =/usr/local/php5520/bin/php-config

    Shell # make & make install

    Shell # vim/usr/local/php5520/etc/php. d/opcache. ini

    ######### Add

    Zend_extension = opcache. so

    Opcache. fast_shutdown = 1

    Opcache. enable_cli = 1

    Opcache. enable = on

    Opcache. memory_consumption = 128

    Opcache. interned_strings_buffer = 8

    Opcache. max_accelerated_files = 4000

    Opcache. revalidate_freq = 30

    ##########



    5. configure to start php-fpm

    Copy the startup file of php-fpm

    Shell # cp-a/usr/local/src/php-5.5.20/sapi/fpm/init. d. php-fpm/etc/rc. d/init. d/php-fpm

    Shell # chmod + x/etc/rc. d/init. d/php-fpm

    Shell #/etc/init. d/php-fpm start


    6. description of the configuration file.

    After installation, the configuration files of php and php-fpm are in the/usr/local/php5520/etc directory.

    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.