11.10/11.11/11.12 Install PHP5 11.13 Install PHP7

11.10/11.11/11.12 Install PHP5

PHP official website www.php.net

The current mainstream version is 5.6/7.1

Please install before installing

yum install -y libxml2-devel openssl openssl-devel bzip2-devel libjpeg-devel libpng-devel
freetype-devel libXpm-devel libmcrypt-devel

cd /usr/local/src/

wget http://cn.php.net/distributions/php-5.6.32.tar.gz

tar xvf php-5.6.32.tar.gz

cd php-5.6.32

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --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 cp php.ini-production /usr/local/php/etc/php.ini

Others /usr/local/php5/bin/php -i | less Use -i to view some php information, such as compilation parameters /usr/local/php5/bin/php -m to view the modules loaded by php

11.13 Install PHP7

11.13 Install PHP7

cd /usr/local/src/

wget http://cn.php.net/distributions/php-7.2.0.tar.gz

tar xvf php-7.2.0.tar.gz

cd php-7.2.0/

./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --enable-soap --enable-mbstring --enable-sockets --enable-exif

make && make install

cp php.ini-production /usr/local/php7/etc/php.ini

other

--with-mysql is not used when php7 ./configure

/usr/local/php7/bin/php -i | less Use -i to view some php information, such as compilation parameters

/usr/local/php7/bin/php -m View the modules loaded by php

ls /usr/local/apache2.4/modules/libphp7.so You can view the php modules. If php5 and php7 have been installed, there will be libphp7.so and libphp5.so

/usr/local/apache2.4/bin/apachectl -M View the modules loaded by http, if you have installed php5 and php7, you will see both

php7_module (shared) and php5_module (shared), which one to use according to your needs

vim /usr/local/apache2.4/conf/httpd.conf // Comment out which one you don't want to use, if you don't comment out one, you will get an error when you start http

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325293940&siteId=291194637