1. Patch PHP-FPM to PHP
[codesyntax lang=”bash”]

$ wget
$ wget
$ tar -jxf php-5.2.17.tar.bz2
$ gzip -d php-5.2.17-fpm-0.5.14.diff.gz
$ patch -d php-5.2.17 -p1 < php-5.2.17-fpm-0.5.14.diff


2. PHP Configure Options for CGI/FastCGI (for help)

[codesyntax lang=”bash”]

--disable-cgi                   Disable building CGI version of PHP
--enable-fastcgi                CGI: Enable FastCGI support in the CGI binary
--enable-force-cgi-redirect     CGI: Enable security check for internal server redirects.
                                Use this if you run the PHP CGI with Apache
--enable-discard-path           CGI: When this is enabled the PHP CGI binary can safely be placed
                                outside of the web tree and people will not be able to circumvent .htaccess security
--disable-path-info-check CGI:  If this is disabled, paths such as /info.php/test?a=b will fail to work
--enable-fpm                    FastCGI: If this is enabled, the fastcgi support
                                will include experimental process manager code
--with-fpm-conf=PATH            Set the path for php-fpm configuration file [PREFIX/etc/php-fpm.conf]
--with-fpm-log=PATH             Set the path for php-fpm log file [PREFIX/logs/php-fpm.log]
--with-fpm-pid=PATH             Set the path for php-fpm pid file [PREFIX/logs/]
--with-xml-config=PATH          FPM: use xml-config in PATH to find libxml

--with-ncurses[=DIR] Include ncurses support (CLI/CGI only) --enable-pcntl Enable pcntl support (CLI/CGI only) --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only) --with-readline[=DIR] Include readline support (CLI/CGI only)


3. Install PHP
[codesyntax lang=”bash”]

$ ./configure --prefix=/usr/local/webserver/php-5.2.17 --with-config-file-path=/usr/local/webserver/php-5.2.17/etc --enable-fastcgi --enable-fpm --with-jpeg-dir= --with-png-dir --with-gd=/usr/local/gd --with-zlib-dir --with-curl --enable-mbstring=cn --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --enable-sysvshm --enable-sysvsem --enable-pcntl --enable-soap --with-freetype-dir --enable-gd-native-ttf --with-iconv-dir --with-imap=/usr/local/imap-c-client --with-imap-ssl --with-pdo-mysql=/usr/local/webserver/mysql
$ make all
$ make install


4. Modify php.ini and php-fpm.conf
[codesyntax lang=”bash”]

$ cp php.ini-dist /usr/local/webserver/php-5.2.17/etc/php.ini
# open display_errors in php.ini

$ vi /usr/local/webserver/php-5.2.17/etc/php-fpm.conf
# uncomment these 2 lines
# <value name="user">nobody</value>
# <value name="group">nobody</value>


5. Test and Start
[codesyntax lang=”bash”]

$ /usr/local/webserver/php-5.2.17/bin/php -v
$ /usr/local/webserver/php-5.2.17/sbin/php-fpm start


Posted in PHP, RHEL | Tagged , | Leave a comment