./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/mysql/ Bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir= /usr--enable-xml--enable-sockets--enable-fpm--with-mcrypt--with-config-file-path=/etc--with-config-file-scan-d IR=/ETC/PHP.D--with-bz2
Make
Make install
[[email protected] php-5.6.24]# CP sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm copy startup script
[Email protected] php-5.6.24]# chmod +x/etc/init.d/php-fpm
[Email protected] php-5.6.24]# chkconfig--add php-fpm
[Email protected] php-5.6.24]# chkconfig php-fpm on
[Email protected] php-5.6.24]# cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf Copy a configuration file to php-fpm
[Email protected] php-5.6.24]# vim/usr/local/php/etc/php-fpm.conf
Pm.max_children = 50 Maximum number of child processes
Pm.start_servers = 5 There are several idle processes just starting up
Pm.min_spare_servers = 2 There are at least a few idle processes
Pm.max_spare_servers = 8 up to a few idle processes
PID =/usr/local/php/var/run/php-fpm.pid defined PID file
Service PHP-FPM Start
------------------------------------------------------
FPM Default authentication on port 9000
Configure HTTPD
Enabling the relevant modules for httpd
After Apache HTTPD 2.4 has a module specifically for the implementation of the FASTCGI, this module is mod_proxy_fcgi.so, it is actually as an extension of the mod_proxy.so module, so the two modules are loaded
LoadModule Proxy_module modules/mod_proxy.so
LoadModule Proxy_fcgi_module modules/mod_proxy_fcgi.so
Configure the virtual host to support the use of fcgi
Add two lines similar to the following in the corresponding virtual host.
Proxyrequests off Apache forward proxy feature
Proxypassmatch ^/(. *\.php) $ fcgi://127.0.0.1:9000/path/to/document_root/$1 Send a file request ending in. php to the PHP-FPM process, php-fpm need to know at least the directory and URI to run, so the two parameters are indicated directly after fcgi://127.0.0.1:9000, and the transmission of the other parameters has been mod_proxy_ The fcgi.so is encapsulated and does not need to be specified manually.
In previous versions of Apache httpd 2.4, either PHP was run as an Apache module or a third-party module was added to support the PHP-FPM implementation.
Gca
<virtualhost *:80>
DocumentRoot "/www/a.org"
ServerName a.org
Serveralias www.a.org
Proxyrequests OFF
Proxypassmatch ^/(. *\.php) $ fcgi://127.0.0.1:9000/www/a.org/$1
<directory "/www/a.org" >
Options None
allowoverride None
Require all granted
</Directory>
</VirtualHost>
--------------------------------------------------------
[email protected] php-5.6.24]# CP Php.ini-production/etc/php.ini
[Email protected] local]# vi/etc/httpd/httpd.conf
#DocumentRoot "/usr/local/apache/htdocs" comment out the central host
To enable a virtual host #Virtual hosts
Include/etc/httpd/extra/httpd-vhosts.conf
[Email protected] local]# vim/etc/httpd/extra/httpd-vhosts.conf
<virtualhost *:80>
DocumentRoot "/www/a.org"
ServerName www.a.org
Proxyrequests OFF
Proxypassmatch ^/(. *\.php) $ fcgi://127.0.0.1:9000/www/a.org/$1
<directory "/www/a.org" >
Options None
allowoverride None
Require all granted
</Directory>
Errorlog "/var/log/httpd/a.org-erro_log"
Customlog "/var/log/httpd/a.org-access_log" combined
</VirtualHost>
[Email protected] local]# vim/etc/httpd/httpd.conf
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so Enabled
LoadModule proxy_module modules/mod_proxy.so Enabled
# If The addencoding directives above is commented-out, then you
# Probably should define those extensions to indicate media types:
#
AddType application/x-httpd-php. PHP Add this line
AddType application/x-httpd-php-source. Phps Add this row
<ifmodule dir_module>
DirectoryIndex index.php index.html Let the Lord also change support index.php
</IfModule>
[[email protected] local]# apache/bin/apachectl start
[Email protected] a.org]# mv index.html index.php
Then you need to install XCache
[email protected] xcache-3.2.0]# CP config.m4. /php/bin/
[Email protected] bin]#./phpize
Configuring for:
PHP Api version:20131106
Zend Module Api no:20131226
Zend Extension Api no:220131226
[Email protected] xcache-3.2.0]#/configure--enable-xcache--with-php-config=/usr/local/php/bin/php-config
Make
[[email protected] xcache-3.2.0]# make install
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
[[email protected] xcache-3.2.0]# CP xcache.ini/etc/php.d/xcache.ini xcache configuration file
[Email protected] xcache-3.2.0]# Vim/etc/php.d/xcache.ini
Extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so
This article from "Operation and maintenance Growth Road" blog, declined reprint!
Compile and install lamp configuration httpd to fastcgi PHP integration