centos7.2 install php7.2

1. Source package download address

Official website link: https://www.php.net/distributions/php-7.2.0.tar.gz

Baidu Cloud: https://pan.baidu.com/s/1zhac_y82wABSgp2QdwCXqA Password: di42
 
tar --zxvf php-7.2.0.tar.gz  

cd php7.2.0  

yum install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel -y

./configure --prefix=/usr/local/php720 --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo

make && make install
 
 
8. Configure nginx.conf to support parsing PHP.
Open the nginx configuration file (/usr/local/nginx/conf/nginx.conf) to
find the localtion module and add index.php after the index to make nginx recognize the php file;
continue Go down and modify again:
Start php-fpm:
1. Copy php-fpm.conf.default to php-fpm.conf
cd /usr/local/php720/etc  
cp php-fpm.conf.default php-fpm.conf 
 
2. Then start php-fpm
/usr/local/php720/sbin/php-fpm,
 
 
if an error is reported (as shown in the figure below):
Solution: Go   to www. Copy conf.default to www.conf, then start php-fpm;
enter the folder (if you can't get in, just cd in step by step; if you don't have this file, create a php-fpm.d folder yourself, and then enter Download the www.conf file from the website: https://pan.baidu.com/s/1o8mRYkU)
cd /usr/local/php720/etc/php-fpm.d  
cp www.conf.default www.conf 
 
 
first put php-fpm Process cleanup
pkill php-fpm
 
Restart php-fpm
/usr/local/php720/sbin/php-fpm and
 
finally create a new file index.php under /usr/local/nginx/html and output phpinfo; the
display is successful, indicating that the php installation is successful   

Guess you like

Origin blog.csdn.net/mjian178/article/details/113101585