Git mirror of php-fpm
Shell C
Permalink
Failed to load latest commit information.
ac Changes for php 5.3 Oct 18, 2009
cgi buildconf - regenerate makefile.in for 5.3.X Oct 18, 2009
conf Minor changes to nginx sample conf Oct 16, 2009
fpm (LP: #439946) installation php-fpm 0.6-5.3.0 on FreeBSD 7.2 (BUGS) Oct 2, 2009
m4 Don't overwrite php-fpm.conf.old on 2nd, 3rd make install Oct 18, 2009
man Configuration option for TCP Port number --with-fpm-port Sep 25, 2009
.gitignore Unix Man page. A few other minor improvements in autoconf macros Aug 24, 2009
INSTALL New script generate-autotools. Documentatiion improved. Aug 10, 2009
LICENSE initial import, based off 0.6.0.2 Jul 10, 2009
Makefile.am (Fix) make install Sep 24, 2009
Makefile.in Don't overwrite php-fpm.conf.old on 2nd, 3rd make install Oct 18, 2009
acinclude.m4 typo Oct 18, 2009
aclocal.m4 ./configure regenerated from acinclude.m4 Aug 10, 2009
autoconf.markdown New script generate-autotools. Documentatiion improved. Aug 10, 2009
buildconf Minor buildconf improvements Sep 25, 2009
compile initial import, based off 0.6.0.2 Jul 10, 2009
config.guess ./configure regenerated from acinclude.m4 Aug 10, 2009
config.m4 Secondary compile check for libevent min version = 1.4.3 Sep 27, 2009
config.sub ./configure regenerated from acinclude.m4 Aug 10, 2009
configure typo Oct 18, 2009
configure.ac (fix) AC_OUTPUT fails when $php_fpm_conf and $php_fpm_init aren't set Oct 18, 2009
depcomp initial import, based off 0.6.0.2 Jul 10, 2009
fpm_autoconfig.h.in (LP: #439946) installation php-fpm 0.6-5.3.0 on FreeBSD 7.2 (BUGS) Oct 2, 2009
generate-autotools Minor buildconf improvements Sep 25, 2009
generate-fpm-patch (LP: #439946) installation php-fpm 0.6-5.3.0 on FreeBSD 7.2 (BUGS) Oct 2, 2009
install-sh initial import, based off 0.6.0.2 Jul 10, 2009
ltmain.sh ./configure regenerated from acinclude.m4 Aug 10, 2009
missing initial import, based off 0.6.0.2 Jul 10, 2009
readme-ru.markdown Additional translations from Anatoly. Many thanks Dec 2, 2009
readme.markdown readme update - directory name in tarball not changed (yet) Nov 12, 2009

readme.markdown

PHP FastCGI Process Manager

PHP-FPM is a Fast-CGI frontend for php, and an enhancement of php-cgi. The project is hosted on Launchpad

Quick start:

Choose one of 2 ways to compile fpm. Either integrated or separate. Unless you are a developer or systems administrator, we recommend the integrated compilation approach. For more information see the file readme.markdown.

Install Dependencies

There are (2) Dependencies. If you haven't built php before, you'll need to install libxml dev package. FPM also requires the Libevent library so install libevent-dev too. The command for debian / ubuntu is:

sudo aptitude install -y libxml2-dev libevent-dev

Libevent 1.4.12-stable or higher is recommended, and at least libevent 1.4.3-stable is required. If no suitable version available, download and compile it from the Libevent website.

export LE_VER=1.4.12-stable
wget "http://www.monkey.org/~provos/libevent-$LE_VER.tar.gz"
tar -zxvf "libevent-$LE_VER.tar.gz"
cd "libevent-$LE_VER"
./configure && make
DESTDIR=$PWD make install
export LIBEVENT_SEARCH_PATH="$PWD/usr/local"

In the above example we have installed libevent into its own directory (by prefixing DESTDIR=$PWD). If that didn't work for you, then use just plain make install to install system-wide.

Integrated compilation

Download fpm and generate the patch file

export PHP_VER=5.3.0
wget "http://launchpad.net/php-fpm/master/0.6/+download/php-fpm-0.6~$PHP_VER.tar.gz"
tar -zxvf "php-fpm-0.6~$PHP_VER.tar.gz"
"php-fpm-0.6-$PHP_VER/generate-fpm-patch"

The PHP source code. Download it, unpack it.

wget "http://us.php.net/get/php-$PHP_VER.tar.gz/from/us.php.net/mirror"
tar xvfz "php-$PHP_VER.tar.gz"
cd "php-$PHP_VER"

Apply the patch and compile

patch -p1 < ../fpm.patch
./buildconf --force
mkdir fpm-build && cd fpm-build
../configure --with-fpm \
--with-libevent="$LIBEVENT_SEARCH_PATH" && make

Separate compilation

There are (2) Dependencies. If you haven't built php before, you'll need to install libxml dev package. FPM also requires the Libevent library. So install libevent-dev too. The command for debian / ubuntu is:

sudo aptitude install -y libxml2-dev libevent-dev

The PHP source code. Download it, unpack it, compile it.

export PHP_VER=5.3.0
wget "http://us.php.net/get/php-$PHP_VER.tar.gz/from/us.php.net/mirror"
tar xvfz "php-$PHP_VER.tar.gz"
cd "php-$PHP_VER"
mkdir php-build && cd php-build
../configure && make

Now you can download, Configure and compile the FPM frontend

wget "http://launchpad.net/php-fpm/master/0.6/+download/php-fpm-0.6~$PHP_VER.tar.gz"
tar -zxvf "php-fpm-0.6~$PHP_VER.tar.gz"
cd "php-fpm-0.6-$PHP_VER"
mkdir fpm-build && cd fpm-build
../configure --srcdir=../ \
 --with-php-src="../../php-$PHP_VER" \
 --with-php-build="../../php-$PHP_VER/php-build" \
 --with-libevent="$LIBEVENT_SEARCH_PATH" && make

Php Configure flags

--with-fpm                   			Build the fpm SAPI (and not php-cgi)
--with-config-file-path=[PATH]			Where to look for php.ini
--with-config-file-scan-dir[=PATH]		Search path for extension .ini files

There are many possible php build flags. Please consult the official php documentation.

  • Note: The following build flags are not used anymore. They are simply ignored by the configure script.

      --enable-fastcgi
      --enable-force-cgi-redirect
    

FPM Configure flags

--with-libevent[=PATH]       Path to the libevent, for fpm SAPI [/usr/local]
--with-fpm-bin[=PATH]        Set the path for the php-fpm binary [/usr/local/bin/php-fpm]
--with-fpm-port[=PORT]       Set the tcp port number to listen for cgi requests [9000]
--with[out]-fpm-conf[=PATH]  Set the path for the php-fpm configuration file [/etc/php-fpm.conf]
--with[out]-fpm-init[=PATH]  Set the path for the php-fpm init file [/etc/init.d/php-fpm]
--with-fpm-log[=PATH]        Set the path for the php-fpm log file [/var/log/php-fpm.log]
--with-fpm-pid[=PATH]        Set the path for the php-fpm pid file [/var/run/php-fpm.pid]
--with-fpm-user[=USER]       Set the user for the php-fpm to run as [nobody]
--with-fpm-group[=GRP]       Set the group for php-fpm to run as. For a system user,
	                         this should be set to match the fpm username [nobody]

Installation

If compiled integrated, then you will get a full php install, including the command line interpreter php-cli, and the PEAR extensions library. The seperate or standalone compilation method will install only the php-fpm daemon and the bare minimum of files required to run it.

# See which files will be installed
make install --dry-run

# Install into '/'
sudo make install

# Install into '/opt'
sudo INSTALL_ROOT=/opt make install

Notes:

  • (Upgrade) When overwriting existing FPM installation files: A previous configuration file php-fpm.conf will be moved to php-fpm.conf.old. Then a newer (default) configuration file will be installed in it's place. If you have any custom XML settings which you wish to keep, its recommended to copy these back over manually.

  • (BSD) the default init.d path is /usr/local/etc/rc.d/php-fpm or disable: --without-fpm-init

  • (Nginx) An example nginx configuration file is generated. The file nginx-site-conf.sample may be installed into your nginx configuration directory, if exists: /etc/nginx/, /usr/local/etc/nginx/, or /usr/local/nginx/conf

More about the PHP-FPM Build process

The make process can be described as:

 1) Compile the php sources into object files in the php build directory
 2) Compile the fpm sources into object files in the fpm build directory
 3) Link all the php object file with these fpm object file together
 4) Output: Static php5 binary, which is php as base and fpm's fast-CGI SAPI as frontend

Fpm is mixed into php at the link-level. Andrei has de-coupled the fpm sources, making the SAPI part somewhat less sensitive to changes in the rest of php. PHP-FPM cgi-main.c request handler is derived from the original fcgi-sapi. We are submitting this 0.6 code to PHP Group. We will track developments in PHP and periodically sync changes back from them into the external / standalone project.

Buildconf

For the external fpm project, generating ./configure requires certiain versions of the autoconf toolset. You need at least some version of autoconf to install these build tools. If you need to use run buildconf, then it will run ./generate-autotools and try to install these locally. If ./buildconf fails please consult the error log.

Mailinglist

There are 2 discussion groups for php-fpm,