1. Source code package download address
https://pan.baidu.com/s/1bpi4D9l
2. Unzip the php compressed package:
tar –zxvf php-7.2.0.tar.gz
3. Enter the decompressed file:
cd php7.2.0
4. Install the extensions required for 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
5. Start configuration---detailed explanation of configuration parameters
./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
6. Compile and install
make && make install
7. 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 scroll down, 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 at startup (as shown below):
Solution: Enter 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 in step by step; if there is no such file, create a php-fpm.d folder 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
The above is the detailed content of Linux source code installation php7.2.0. For more information, please follow other related articles on the PHP Chinese website!