11.10-11.12 Installation PHP5
PHP official website www.php.net
Current mainstream version is 5.6/7.1
Most companies use 5 more
1 CD
#cd/usr/local/src/
2 download Package
#wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2
3 Decompression
# tar JXVF php-5.6.30.tar.bz2
4 entering the package for initialization, compilation, installation
#cd php-5.6.30
5 Configuration parameters: (This configuration parameter is the Tiger balm, parameter corresponding function, generally no specific requirements according to the following copy all can be)
./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
During the initial and compilation process, error messages may appear, most of which are missing part of the library package. During this period, a series of errors may occur, as follows:
An error occurred 1
Configure:error:Cannot find OpenSSL ' s <evp.h>
Workaround
#yum install-y OpenSSL Openssl-devel
An error occurred 2
Checking for BZIP2 in default path ... not found
Configure:error:Please Reinstall the BZIP2 distribution
Workaround
#yum install-y bzip2 Bzip2-devel
An error occurred 3
Configure:error:jpeglib.h not found.
Workaround
#yum install-y libjpeg Libjpeg-devel
Error 4
Configure:error:freetype-config not found.
Workaround
#yum install-y FreeType Freetype-devel
Error 5
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Workaround
#yum install-y Epel-release
#yum install-y Libmcrypt-devel
Initialized successfully,
6 #make && make install
# ls/usr/local/php/bin/php This binary php file is the core file of the entire PHP
#ls/usr/local/apache2.4/modules/libphp5.so This is the file for Apache and PHP-connected modules
View PHP-Loaded modules
#/usr/local/php/bin/php-m
7 Copying a configuration file
#cp Php.ini-production/usr/local/php/etc/php.ini
Use-i|less to view PHP configuration information, compile parameters, configure path
# ls/usr/local/php/bin/php-i |less
The load path is empty before the CP file
After the CP, there are more specific paths.
11.13 Installing PHP7
1 cd/usr/local/src/
2 wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
3 Tar zxf php-7.1.6.tar.bz2
4 CD php-7.1.6
5./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-exif
6 Make && make install
7 in apache2.4/modules/View PHP7 's libphp7.so module file, which also has libphp5.so
#ls/usr/local/apache2.4/modules/libphp7.so
[Email protected] php-7.1.6]# ls/usr/local/apache2.4/modules/libphp
Libphp5.so libphp7.so
PHP5 and PHP7 can only use one at a time, so modify the Apache httpd configuration file.
If you do not want to use one of them, comment, but you can only leave one.
8 CP Php.ini-production/usr/local/php7/etc/php.ini
11.10-11.13 PHP5 and PHP7 installation