PHP official website www.php.net
Current mainstream version is 5.6/7.1
cd /usr/local/src/ wget http://cn2.php.net/distributions/php-5.6.30.tar.gztar zxf php-5.6.30.tar.gzcd php-5.6.30./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc
The lengthy troubleshooting process starts below
Yum provides xml2-config
Yum install-y libxml2-devel
Yum list |grep-i OpenSSL
Yum I Nstall-y OpenSSL openssl-devel
Yum install-y bzip2-devel
Yum install-y libjpeg-devel
Yum Install -y libpng-devel
Yum install-y freetype-devel
Yum install-y epel-release
Yum install-y Libmcrypt-devel
continue./configure.
Make && make install
CP php.ini-production/usr/local/php/etc/php.ini//copy config file
After the installation is complete, we look for the PHP module we want libphp5.so
Ls/usr/local/apache2.4/modules/libphp5.so can find
Du-sh!$ see its size, found around 36M
This shows that we have successfully installed PHP
PHP7 installation
method is the same as PHP5, that is./configure when you change the installation path, and the configuration file path
cd /usr/local/src/ wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2tar zxf php-7.1.6.tar.bz2cd php-7.1.6./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exifmake && make install
ls/usr/local/apache2.4/modules/libphp*
CP Php.ini-production/usr/local/php7/etc/php.ini
Finally, we summarize the packages to be downloaded:
yum install -y libxml2-devel yum install -y openssl openssl-devel yum install -y bzip2-devel yum install -y libjpeg-devel yum install -y libpng-devel yum install -y freetype-devel yum install -y epel-release yum install -y libmcrypt-devel
Linux Learning Summary (32) Lamp PHP Installation