1. PHP download
https://secure.php.net/downloads.php
Search the China mirror site and download it from here
Http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror
Help documentation
https://secure.php.net/download-docs.php
2. Pre-compilation configuration
./configure--enable-fpm;
Encountered error, missing Libxml2-devel package;
Redhat:
Yum Search LIBXML2
Yum Install-y libxml2-devel
Debian:
Apt-cache Search Libxml2-dev
Apt-get Install Libxml2-dev
3. Compiling the installation
Make && make install
4. Copy and modify the configuration file
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
Sed-i '/^include=/s#none#/usr/local#g '/usr/local/php/etc/php-fpm.conf
Cp/usr/local/etc/php-fpm.d/www.conf.default/usr/local/etc/php-fpm.d/www.conf
The www.conf can be configured with a PHP-FPM listening port
5. Start PHP-FPM
/USR/LOCAL/SBIN/PHP-FPM;
Check whether to start lsof-i:9000
6. Configure Nginx support PHP
The Nginx configuration file for Ubuntu is/etc/nginx/sites-available/default
Location ~ \.php$ {
root/var/www;
#指定php的根目录
Fastcgi_pass 127.0.0.1:9002;
The default port for #php-FPM is 9000
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
Nginx Enable PHP