In the front I have studied the mod_php mode in PHP and the mode_fastcgi and PHP-FPM mode: address, which roughly tells the difference between several modes, and also understands that PHP-FPM is the manager of fastcgi mode. Let's take a look at how PHP installs PHP-FPM and runs it today. Install PHP-FPM
My machine is CentOS 6.2 has been installed before the PHP 5.4.11,php after 5.3.3 has been speaking php-fpm written to the core of the PHP source. So no additional downloads are required. I'm 5.4.11, so I can use it directly.
Since I have PHP installed, and did not take the FPM mode before the compile, I have to find the source code recompile:
To enable PHP to support PHP-FPM, you just have to take--enable-fpm at compile time.
So, I need to find the previous compilation parameters, followed by--ENABLE-FPM, recompile. Previously said, there are 2 ways to find the previous compilation parameters: in the source code/lamp/php-5.4.11/find Config.nice, this is the previous compilation parameters in the php.ini configuration file to find the Configure-related configuration:
/usr/local/php/bin/php-i |grep ' Configure '
OK, let's get started and find the previous compilation parameters:
[Root@localhost/]# cd/lamp/php-5.4.11 & VI config.nice './configure ' '--prefix=/usr/local/php ' \ '--with-config-f ile-path=/usr/local/php/etc/'--with-apxs2=/usr/local/apache/bin/apxs ' and '--with-mysql=/usr/local/mysql/'- with-libxml-dir=/usr/local/libxml2/'--with-png-dir=/usr/local/libpng/'--with-jpeg-dir=/usr/local/jpeg8/' --with-freetype-dir=/usr/local/freetype/'--with-gd=/usr/local/gd/' and '--with-zlib-dir=/usr/local/zlib/'- with-mcrypt=/usr/local/libmcrypt/'--with-mysqli=/usr/local/mysql/bin/mysql_config ' and '--enable-soap '- Enable-mbstring=all '--enable-sockets ' \
After adding--ENABLE-FPM, recompile:
[Root@localhost/]# cd/lamp/php-5.4.11 [root@localhost php-5.4.11]# './configure '--prefix=/usr/local/php '] with-config-file-path=/usr/local/php/etc/'--with-apxs2=/usr/local/apache/bin/apxs '--with-mysql=/usr/local/ mysql/'--with-libxml-dir=/usr/local/libxml2/'--with-png-dir=/usr/local/libpng/'--with-jpeg-dir=/usr/ local/jpeg8/'--with-freetype-dir=/usr/local/freetype/'--with-gd=/usr/local/gd/'--with-zlib-dir=/usr/ local/zlib/'--with-mcrypt=/usr/local/libmcrypt/' and '--with-mysqli=/usr/local/mysql/bin/mysql_config '- Enable-soap '--enable-mbstring=all ' \ '--enable-sockets ' \--enable-fpm ' [root@localhost php-5.4.11] Make && Make install
Start PHP-FPM
After the installation is complete, we try to start:
The Start command is:
/usr/local/php/sbin/php-fpm
An error has been made:
[26-feb-2015 15:39:55] error:failed to open configuration file '/usr/local/php/etc/php-fpm.conf ': No such file or directory (2) [26-feb-2015 15: 39:55] error:failed to load configuration file '/usr/local/php/etc/php-fpm.conf ' [26-feb-2015 15:39:55] ERROR:FPM Initia Lization failed
Error message says Php-fpm.conf not found
Oh, the original is php-fpm.conf not yet, we go to the/USR/LOCAL/PHP/ETC directory will php-fpm.conf.default copy also a php-fpm.conf
CD/USR/LOCAL/PHP/ETC/CP Php-fpm.conf.default php-fpm.conf
Edit this configuration file:
Vim php-fpm.conf