11.10/11/12 installation PHP5
PHP official website Www.php.net, the current mainstream version is 5.6 and 7.1
Brief steps to install PHP5:
- Cd/usr/local/src
- wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
- Tar zxvf php-5.6.30.tar.gz
- CD 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
Configure successful execution interface:
- Make
Make successful execution interface:
- Make install
Make install successfully executes the interface:
- CP Php.ini-production/usr/local/php/etc/php.ini #拷贝配置文件
- /usr/local/php/bin/php-m #查看所加载的模块
- /usr/local/php/bin/php-i |less #查看加载信息 (configuration files, parameters, etc.)
- View PHP Compilation parameters
/usr/local/php/bin/php-i |grep Configure
- libphp5.so/libphp5.so----> PHP and Apache communicate with each other in the media:
PHP is in the form of a module in Apache, specific to the program level is PHP installation, will be in the Apache/usr/local/apache2.4/modules/directory to generate a similar libphp5.so/libphp7.so module, To achieve the interaction between Apache and PHP.
Problems encountered during installation:
- Question 1:
Workaround:
Yum Install-y libxml2-devel
- Question 2:
Workaround:
Yum Install-y openssl-devel
- Question 3:
Workaround:
Yum Install-y bzip2-devel
- Question 4:
Workaround:
Yum Install-y libjpeg-devel
- Question 5:
Workaround:
Yum Install-y libpng-devel
- Question 6:
Workaround:
Yum Install-y freetpy-devel
- Question 7:
Workaround:
Yum Install-y libmcrypt-devel
Note : Installing the MCrypt requires installing the epel-release extension source first and installing the epel-release.11.13 installation if it is not installed PHP7
- PHP7 installation and PHP5 similar, in addition to the installation directory is different, and PHP7 configuration parameters are not--with-mysql=/usr/local/mysql, the other basic.
- Brief steps to install PHP7:
- cd/usr/local/src/
- wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
- Tar jxvf php-7.1.6.tar.bz2
- CD 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-exif
- Make && make install
- Ls/usr/local/apache2.4/modules/libphp7.so
- CP Php.ini-production/usr/local/php7/etc/php.ini
- PHP7 Installation Successful interface:
Important Information:
PHP5 and PHP7 can be installed on the same machine, which PHP does the Apache call in this case? This can be specified in the Apache configuration file/usr/local/apache2.4/conf/httpd.conf, and you want to use that to keep that.
2018-2-28 Linux Learning Notes