Nginx Enable PHP

Source: Internet
Author: User
Tags php download

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.