Centos7.2 Steps to compile and install PHP7.0.2
- 2020-06-07 05:58:11
- OfStack
The environment
System: Centos7. 2 Service: Nginx1: Download the installation package of PHP7.0.2 extract, compile and install:
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
$ tar -xzxvf php-7.0.2.tar.gz
$ cd php-7.0.2
1.1 Pre-compile check
Check to see if gcc is installed, or if not, yum install gcc
Check if libxml2 is installed and if not, execute yum install libxml2
Check whether libxml2-ES27en is installed or not. If not, execute yum install libxml2-ES31en
Note: the compilation parameter -- ES36en-apxs2 =/usr/bin/apxs has been removed because nginx is used instead. To configure apache, please install apache before installing PHP. *
2: Compile parameter configuration
'./configure' '--prefix=/usr/local/php' '--with-pdo-pgsql' '--with-zlib-dir' '--with-freetype-dir' '--enable-mbstring' '--with-libxml-dir=/usr' '--enable-soap' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-gd' '--with-pgsql' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--enable-exif' '--enable-bcmath' '--with-mhash' '--enable-zip' '--with-pcre-regex' '--with-pdo-mysql' '--with-mysqli' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-openssl' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-libdir=/lib/x86_64-linux-gnu/' '--enable-ftp' '--with-gettext' '--with-xmlrpc' '--with-xsl' '--enable-opcache' '--enable-fpm' '--with-iconv' '--with-xpm-dir=/usr'
3: Error set
An error Cannot find OpenSSL's <evp.h>
perform yum install openssl openssl-devel
An error Please reinstall the libcurl distribution
perform yum -y install curl-devel
error jpeglib.h not found
perform yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
And perform yum install libjpeg-devel
Error: checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution This is a bzip2 Software package not installed
perform yum install bzip2-devel.x86_64 -y
Error: configure: error: xpm.h not found.
perform yum install libXpm-devel
error : Unable to locate gmp.h
perform yum install gmp-devel
Error: Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works
perform yum install -y icu libicu libicu-devel
Error: mcrypt.h not found. Please reinstall libmcrypt.
perform yum install php-mcrypt libmcrypt libmcrypt-devel
Error: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
perform yum install postgresql-devel
Error: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
perform yum install libxslt-devel
4: compile
make clean && make && make install
5: PHP configuration
5.1 After installation, we will copy the configuration file in the source package to the PHP installation directory. There are two configuration php. ini-ES66en. ini-ES68en
cp php.ini-development /usr/local/php/lib/php.ini
5.2 You also need to set the environment variable: modify the /etc/profile file to make it permanent and effective for all system users by adding the following two lines at the end of the file
PATH=$PATH:/usr/local/php/bin
export PATH
5.3 Then execute the effective order
source /etc/profile
5.4 View PHP version information
php -v
6: Configuration PHP-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /usr/src/php-7.0.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
6.1 start php - fpm:
/etc/init.d/php-fpm start
6.2 Error: [pool www] cannot get for www '
Then create es112EN-ES113en user group:
groupadd www-data
useradd -g www-data www-data
6.3 restart php - fpm
An error Cannot find OpenSSL's <evp.h>
perform yum install openssl openssl-devel
An error Please reinstall the libcurl distribution
perform yum -y install curl-devel
error jpeglib.h not found
perform yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
And perform yum install libjpeg-devel
Error: checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution This is a bzip2 Software package not installed
perform yum install bzip2-devel.x86_64 -y
Error: configure: error: xpm.h not found.
perform yum install libXpm-devel
error : Unable to locate gmp.h
perform yum install gmp-devel
Error: Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works
perform yum install -y icu libicu libicu-devel
Error: mcrypt.h not found. Please reinstall libmcrypt.
perform yum install php-mcrypt libmcrypt libmcrypt-devel
Error: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
perform yum install postgresql-devel
Error: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
perform yum install libxslt-devel
0