Linux under Nginx install PHP

Source: Internet
Author: User

Upload the PHP installation package to Linux/USR/LOCAL/SRC

1. Unzip

Cd/usr/local/srctar ZXVF PHP-5.6.9.TAR.GZCD php-5.6.9

  

2. Compiling the installation

./configure--prefix=/usr/local/php  --enable-fpm--with-mcrypt--enable-mbstring--enable-pdo--with-curl-- Disable-debug  --disable-rpath--enable-inline-optimization--with-bz2  --with-zlib--enable-sockets-- Enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--with-mhash--enable-zip--with-pcre-regex-- With-mysql--with-mysqli--with-gd--with-jpeg-dir--with-freetype-dir--enable-calendar

  

Error 1

Configure:error:xml2-config not found. Please check your LIBXML2 installation. Configuration: Error: Xml2-config is missing. Please check your LIBXML2 installation. Solution: Yum Install libxml2 libxml2-devel-y

  

Error 2

Configure:error:Cannot find OpenSSL ' s <evp.h> configuration: Error: Unable to find OpenSSL < evp.h > Workaround: Yum install OpenSSL Openssl-devel-y

  

Error 3

Configure:error:Please Reinstall the BZIP2 distribution configuration: Error: Reinstall BZIP2 Distribution Solution: Yum Install bzip2 bzip2-devel-y

  

Error 4

Configure:error:jpeglib.h not found. Configuration: Error: Jpeglib. Not found. Solution: Yum Install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel-y

  

Error 5

Configure:error:mcrypt.h not found. Please reinstall Libmcrypt. Configuration: Error: MCrypt. Not found. Please reinstall Libmcrypt. FIX: Install epel-release source Yum install Epel-release-yyum install Libmcrypt-devel–y

  

Finally, the most important

Makemake Install

  

3. Copy the PHP master configuration file

CP Php.ini-production/usr/local/etc/php.ini

2. Provide configuration files for PHP-FPM

CD/USR/LOCAL/PHPCP Etc/php-fpm.conf.default Etc/php-fpm.confvim etc/php-fpm.conf

  

Modify

user = Www-datagroup = Www-data

  

If the Www-data user does not exist, add the Www-data user first, the command line:

Groupadd www-datauseradd-g Www-data Www-data

Configuration file Modification

  

3. Start PHP-FPM

Perform

/usr/local/php/sbin/php-fpm

Use the following command to verify if the command output has several PHP-FPM processes that indicate that the boot was successful:

PS aux | grep php-fpm

3, Nginx and PHP-FPM integration

Edit/usr/local/nginx/nginx.conf

Vim/usr/local/nginx/nginx.conf

Modify the following:

The "#" in the red box is removed

The "#" in the red box is removed

Add content in a red box

Change to the following

Location ~ \.php$ {            root         html;            Fastcgi_pass 127.0.0.1:9000;            Fastcgi_index index.php;            Include        fastcgi.conf;}

Reload the Nginx configuration file:

/usr/loca/nginx/sbin/nginx-s Reload

  

4. Test PHP files

Create the index.php file under/usr/local/nginx/html, and enter the following:

<?php    phpinfo ();? >

  

5. Browser access

Visit http://Your server ip/index.php, you can see the PHP information.

Reference: http://www.cnblogs.com/flywind/p/6019631.html (PHP-FPM)

Linux under Nginx install 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.