Linux PHP-FPM

Source: Internet
Author: User

Nginx itself can not handle PHP, it is just a Web server, when the request is received, if it is a PHP request, then sent to the PHP interpreter processing, and the results returned to the client.

Nginx is generally the request to send fastcgi management process processing, FASCGI management process Select the CGI subprocess processing results and return to be Nginx

This article takes php-fpm as an example to explain how to make Nginx support PHP

I. Compiling and installing PHP-FPM

What is PHP-FPM

PHP-FPM is a PHP fastcgi manager that is only used in PHP and can be downloaded in http://php-fpm.org/download.

PHP-FPM is actually a patch of PHP source code, designed to integrate FASTCGI process management into the PHP package. It must be patch to your PHP source code and can be used only after compiling and installing PHP.

The new version of PHP has been integrated PHP-FPM, no longer a third party package, recommended use . PHP-FPM provides a better way to manage PHP processes, can effectively control memory and process, can smooth overload PHP configuration, more than spawn-fcgi have a bit more, so the official PHP included. In the./configure with the –ENABLE-FPM parameter can be opened PHP-FPM, the other parameters are configured PHP, the meaning of the specific options can be viewed here.

Prepare before installation
Execute under CentOS

Install gcc automake autoconf libtool make yum-y install gcc gcc-c++ glibc yum-y install libmcrypt-devel MHAs yum-y H-devel libxslt-devel \ libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \ zlib Zli B-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs e2fsprogs -devel \ krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel

New PHP-FPM installation (recommended installation method)

wget http://cn2. php.net/distributions/php-5.4.7. Tar. GZ tar zvxf php-5.4.7. Tar. gz CD php-5.4.7. /configure--prefix=/usr/local/php --enable-fpm--with-mcrypt, enable-mbstring--disable-pdo,--with-curl isable-debug --disable-rpath \--Enable-inline-optimization--with-bz2 --with-zlib--enable-sockets \--E Nable-sysvsem--ENABLE-SYSVSHM--enable

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.