• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Shell
  • License
    Other
  • Created over 15 years ago
  • Updated almost 15 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git mirror of php-fpm

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,

More Repositories

1

docker-images

Dreamcat4's Docker Images (Trusted Builds)
Perl
155
star
2

lwip

Git clone of the Lightweight TCP/IP Stack. CHECK UPSTREAM FOR LATEST SRC -->
C
149
star
3

FastDelegate

Delegates for C++ by Don Clugston
C
105
star
4

t12-t245-controllers-docs

HTML
82
star
5

CmdMessenger2

Fork of Neil Dudman's CmdMessenger. Serial messaging system for Arduino platform
Java
67
star
6

lgremote

A command line program to remotely control 2011 LG "Smart" TVs.
Ruby
36
star
7

efi-enable-vtx

Permanently Enable VT-X for Apple EFI Firmwares
28
star
8

brew-launchd

For Mac Homebrew. An extension to start and stop Launchd services.
Ruby
17
star
9

Mcp4261

Arduino library for the Microchip MCP4261
C++
16
star
10

Mcp23s17

Arduino library for the Microchip MCP23S17
C++
12
star
11

finch

This project is deprecated / obsolete / EOL. Please use modern alternatives instead
Shell
10
star
12

ktuikit

Git mirror of KatiDev's KTUIKit Cocoa Framework. NSViewController extensions and enhancements.
Objective-C
7
star
13

PS3RemoteCocoa

Example to show communication between Sony PS3 BD Remote and Cocoa.
Objective-C
7
star
14

plist4r

Plist4r - Read, write and edit plists in ruby
Ruby
6
star
15

objcpp-h

Objective-C++ toolkit for iPhone SDK - this code may be out-of date please check the official website
C
5
star
16

lingon

LingonSource code, version 2.1.1, downloaded from SourceForge.net
Objective-C
4
star
17

script

Modified examples to reproduce an error case
Ruby
4
star
18

MediaKeys

A small headless Cocoa App, which responds to the MediaKeys on Apple Wireless keyboards.
Objective-C
4
star
19

renv

Ruby
4
star
20

potion-extra

Dreamcat4's hacks, fixes and other personal customizations to potionstore. If you would like to check out potionstore, its recommended to follow the official upstream repository maintained by Andy Kim.
Ruby
4
star
21

nas4free

NAS4Free revision 975 + my patches
PHP
2
star
22

gitnest

Submodules for the rest of us
Ruby
2
star
23

CmdLine

Brad Appleton's CmdLine Library - for C++
C
2
star
24

yamldoc

A simple solution for ERB enabled YAML file.
Ruby
1
star
25

rails_app

Ruby
1
star
26

iphone-opengl

Example Project for iPhone OpenGL
Objective-C
1
star
27

testr

TODO: longer description of your gem
Ruby
1
star
28

iPhone-Wax-Simple-Sample-App

A sample app demonstrating a native UIKit iPhone apps written in Lua
C
1
star
29

jeweler-ghpages-test-1

Ghpages test
Ruby
1
star
30

cocolua

example cocoa and lua integration
C
1
star
31

jeweler-ghpages-test-2

Ghpages test 2
Ruby
1
star
32

php5-5.2.10.dfsg.1

New 'php-fpm' build target for ubuntu packaged php src tree. Only the 'debian/' folder.
Shell
1
star
33

moonshadow_old

Abandoned, moved over to chef
Ruby
1
star
34

yard-slipstream

Streamlined Navigation with the default yard template
Ruby
1
star
35

test4u

Ruby
1
star
36

Ps3Remote

Arduino library - for controlling a Ps3 BD Remote via customized circuitry
C
1
star