Linux source installation php7.2.0

1. Source package download address
 
https://pan.baidu.com/s/1bpi4D9l  

 

2. Unzip the php archive
tar –zxvf php-7.2.0.tar.gz  

 

3. Enter the decompressed
cd php7.2.0  

 

4. Install the extensions required by php
yum install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel -y

 

6. Start configuration
./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

 

7. Compile and install
 
make && make install

 

 
8. Configure nginx.conf to support parsing PHP
Open the nginx configuration file (/usr/local/nginx/conf/nginx.conf)
Find the localtion module and add index.php after index to make nginx recognize the php file;
Continue to slide down, and then modify:
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 the startup reports an error (as shown below):
Solution: Go to www.conf.default under /usr/local/php720/etc/php-fmp.d and copy it to www.conf , then start php-fpm;
Enter the folder (if you can't enter, just cd into it step by step; if you don't have this file, create a php-fpm.d folder by yourself, and then go to the website to download the www.conf file: https://pan.baidu. com/s/1o8mRYkU)
cd /usr/local/php720/etc/php-fpm.d  
cp www.conf.default www.conf 

 

 
First clear the php-fpm process
pkill php-fpm

 

Restart php-fpm
/usr/local/php720/sbin/php-fpm

 

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 http://43.154.161.224:23101/article/api/json?id=325256384&siteId=291194637