How to Build PHP7.0.x in Centos to make php5.3 and php7 compatible

Source: Internet
Author: User
Tags fpm sapi centos

Install php5.3 first, not to mention, saying that the Centos PHP7.0 tutorial is:

# Wget http://php.net/get/php-7.0.4.tar.gz/from/a/mirror

Unzip and install
# Tar zxvf php-7.0.4.tar.gz
# Cd php-7.0.4

Check the installation help.
#./Configure -- help

My blog was originally installed under/usr/local/php in 5.3, so I installed php7 in/usr/local/php7 in the new version,

#./Configure -- prefix =/usr/local/php7 \
-- With-curl \
-- With-freetype-dir \
-- With-gd \
-- With-gettext \
-- With-iconv-dir \
-- With-kerberos \
-- With-libdir = lib64 \
-- With-libxml-dir \
-- With-mysqli \
-- With-openssl \
-- With-pcre-regex \
-- With-pdo-mysql \
-- With-pdo-sqlite \
-- With-pear \
-- With-png-dir \
-- With-xmlrpc \
-- With-xsl \
-- With-zlib \
-- Enable-fpm \
-- Enable-bcmath \
-- Enable-libxml \
-- Enable-inline-optimization \
-- Enable-gd-native-ttf \
-- Enable-mbregex \
-- Enable-mbstring \
-- Enable-opcache \
-- Enable-pcntl \
-- Enable-shmop \
-- Enable-soap \
-- Enable-sockets \
-- Enable-sysvsem \
-- Enable-xml \
-- Enable-zip


Because I have installed the relevant libraries, I do not need to install them any more. If an error is reported during installation, run the yum command.

If the configuration is incorrect, you need to install the required modules and install the dependent libraries together with yum.
# Yum-y install libjpeg-devel libpng-devel \

Freetype-devel libxml2 libxml2-devel for mysql pcre-devel

Note:

Many so-called tutorials on the Internet are direct:

# Make & make install

However, the following error may occur: make: *** [sapi/cli/php] error 1

In fact, this will do:

Make ZEND_EXTRA_LIBS = '-liconv'

Make install

 

Make some configuration.

# Cp php. ini-production/usr/local/php7/etc/php. ini
# Cp/usr/local/php7/etc/php-fpm.conf.default/usr/local/php7/etc/php-fpm.conf
# Cp/usr/local/php7/etc/php-fpm.d/www. conf. default/usr/local/php7/etc/php-fpm.d/www. conf
# Cp-R./sapi/fpm/php-fpm/etc/init. d/php-fpm7


Note that the configuration file www. conf in php7 configures the phpfpm port number and other information, because php5.3 and php7 are compatible and coexist,

So I changed the PHP 7 port to 9001, and modified usr/local/php7/etc/php-fpm.d/www. conf.

Restart:/etc/init. d/php-fpm7 start

Related Article

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.