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