Installing PHP5
PHP Official website: www.php.net
Current mainstream version is 5.6/7.1
MySQL and Apache must be installed before installing PHP.
Download and Unzip
cd /usr/local/src/wget http://cn2.php.net/distributions/php-5.6.30.tar.gztar zxvf php-5.6.30.tar.gz
installation files
cd /usr/local/src/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 --with-mysql=/usr/local/mysql --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-exif
Compiling and installing
make && make install
Set the Load file
cp /usr/local/src/php-5.6.30/php.ini-production /usr/local/php/etc/php.ini
View configuration file load Directory
/usr/local/php/bin/php -i |less
Information notes for installation content
--prefix= Installation path for PHP
--with-apxs2= Apache's APXS tools catalogue
--with-config-file-path= specifying the configuration file path
--with-mysql= specifying the path to MySQL
--with-pdo-mysql=
--with-mysqli=
All subsequent--with-are designated modules
Installation error and handling error 1:
Error message:
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
Treatment scenarios:
Missing XML2 This package, search and install it, the general installation is the library files, that is, the package behind with devel;
Yum List |grep XML2
Yum Install-y libxml2-devel
Error 2:
Error message:
Configure:error:Cannot find OpenSSL ' s <evp.h>
Treatment scenarios:
The OpenSSL package is missing, search and install it, generally installed is the library file is openssl-devel;
Yum List |grep OpenSSL
Yum Install-y openssl-devel
Error 3:
Error message:
Configure:error:Please Reinstall the BZIP2 distribution
Treatment scenarios:
Missing bzip2 package, search and install its library file;
Yum List |grep-i bzip2
Yum Install-y bzip2-devel
Error 4:
Error message:
Configure:error:jpeglib.h not found.
Treatment scenarios:
This is missing is Libjpeg-devel package, but there is no libjpeg-devel inside the system, search Jpeglib is not the search;
The last matched package is Libjpeg-turbo-devel
Yum List |grep-i jpeg
Yum Install-y libjpeg-devel
Error 5:
Error message:
Configure:error:png.h not found.
Solution:
Missing Libpng-devel packet, search for the wrong hint of PNG query;
Yum List |grep-i png
Yum Install-y libpng-devel
Error 6:
Error message:
Configure:error:freetype-config not found.
Solution:
Lack of freetype-devel, it is best to first search and then install;
Yum List |grep-i FreeType
Yum Install-y freetype-devel
ERROR 7:
Error message:
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Solution:
Missing MCrypt, please install epel-release and install MCrypt first;
Important things say three times: Be sure to install epel-release before installing libtomcrypt-devel;
Important things say three times: Be sure to install epel-release before installing libtomcrypt-devel;
Important things say three times: Be sure to install epel-release before installing libtomcrypt-devel;
Yum Install-y epel-release
Yum List |grep-i Mcry
Yum Install-y libtomcrypt-devel
If not successful then use Yum to remove the two packages to reinstall
Yum Erase Epel-release.noarch
Yum Erase Libtomcrypt
Installation of php5.6