Skip to content

Commit

Permalink
Configuration option for TCP Port number --with-fpm-port
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamcat4 committed Sep 25, 2009
1 parent 9eb54f0 commit 44504ee
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
11 changes: 11 additions & 0 deletions ac/fpm_conf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AC_DEFUN([AC_FPM_ARGS],
PHP_ARG_WITH(fpm-bin,,
[ --with-fpm-bin[=PATH] Set the path for the php-fpm binary [/usr/local/bin/php-fpm]], yes, no)
PHP_ARG_WITH(fpm-port,,
[ --with-fpm-port[=PORT] Set the tcp port number to listen for cgi requests [9000]], yes, no)
PHP_ARG_WITH(fpm-conf,,
[ --with-fpm-conf[=PATH] Set the path for php-fpm configuration file [/etc/php-fpm.conf]], yes, no)
Expand Down Expand Up @@ -41,6 +44,12 @@ AC_DEFUN([AC_FPM_VARS],
php_fpm_bin=`basename $php_fpm_bin_path`
php_fpm_bin_dir=`dirname $php_fpm_bin_path`
if test -z "$PHP_FPM_PORT" -o "$PHP_FPM_PORT" = "yes" -o "$PHP_FPM_PORT" = "no"; then
php_fpm_port="9000"
else
php_fpm_port="$PHP_FPM_PORT"
fi
if test -z "$PHP_FPM_CONF" -o "$PHP_FPM_CONF" = "yes" -o "$PHP_FPM_CONF" = "no"; then
php_fpm_conf_path="/etc/php-fpm.conf"
else
Expand Down Expand Up @@ -80,6 +89,7 @@ AC_DEFUN([AC_FPM_VARS],
PHP_SUBST_OLD(php_fpm_bin)
PHP_SUBST_OLD(php_fpm_bin_dir)
PHP_SUBST_OLD(php_fpm_bin_path)
PHP_SUBST_OLD(php_fpm_port)
PHP_SUBST_OLD(php_fpm_conf)
PHP_SUBST_OLD(php_fpm_conf_dir)
PHP_SUBST_OLD(php_fpm_conf_path)
Expand All @@ -95,6 +105,7 @@ AC_DEFUN([AC_FPM_VARS],
AC_DEFINE_UNQUOTED(PHP_FPM_BIN, "$php_fpm_bin", [fpm binary executable])
AC_DEFINE_UNQUOTED(PHP_FPM_BIN_DIR, "$php_fpm_bin_dir", [fpm binary dir])
AC_DEFINE_UNQUOTED(PHP_FPM_BIN_PATH, "$php_fpm_bin_path", [fpm bin file path])
AC_DEFINE_UNQUOTED(PHP_FPM_PORT, "$php_fpm_port", [tcp port])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF, "$php_fpm_conf", [fpm conf file])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_DIR, "$php_fpm_conf_dir", [fpm conf dir])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_PATH, "$php_fpm_conf_path", [fpm conf file path])
Expand Down
9 changes: 9 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ AC_DEFUN([AC_FPM_PATHS],
AC_ARG_WITH([fpm-bin],
AC_HELP_STRING([--with-fpm-bin=@<:@PATH@:>@], [Set the path for php-fpm binary @<:@/usr/local/bin/php-fpm@:>@]))
AC_ARG_WITH([fpm-port],
AC_HELP_STRING([--with-fpm-port=@<:@PORT@:>@], [Set the tcp port number to listen for cgi requests @<:@9000@:>@]))
AC_ARG_WITH([fpm-conf],
AC_HELP_STRING([--with-fpm-conf=@<:@PATH@:>@], [Set the path for php-fpm configuration file @<:@/etc/php-fpm.conf@:>@]))
Expand Down Expand Up @@ -414,6 +417,12 @@ AC_DEFUN([AC_FPM_PATHS],
php_fpm_bin=`basename $php_fpm_bin_path`
php_fpm_bin_dir=`dirname $php_fpm_bin_path`
if test -z "$with_fpm_port" -o "$with_fpm_port" = "yes" -o "$with_fpm_port" = "no"; then
php_fpm_port="9000"
else
php_fpm_port="$with_fpm_port"
fi
if test -z "$with_fpm_conf" -o "$with_fpm_conf" = "yes" -o "$with_fpm_conf" = "no"; then
php_fpm_conf_path="/etc/php-fpm.conf"
else
Expand Down
4 changes: 2 additions & 2 deletions conf/nginx-site-conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ server {
root /var/www/nginx-default;
}

# pass the *.php scripts to @php_fpm_bin@ listening on port 9000
# pass the *.php scripts to @php_fpm_bin@ listening on tcp port @php_fpm_port@
#
location ~ \.php$ {

root $site_root;
fastcgi_pass 127.0.0.1:9000;
fastcgi_pass 127.0.0.1:@php_fpm_port@;
fastcgi_index index.php;

include fastcgi_params;
Expand Down
2 changes: 1 addition & 1 deletion conf/php-fpm.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">127.0.0.1:9000</value>
<value name="listen_address">127.0.0.1:@php_fpm_port@</value>

<value name="listen_options">

Expand Down
15 changes: 8 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ AC_SUBST(fpm_version)
AC_SUBST(php_fpm_bin)
AC_SUBST(php_fpm_bin_dir)
AC_SUBST(php_fpm_bin_path)
AC_SUBST(php_fpm_port)
AC_SUBST(php_fpm_conf)
AC_SUBST(php_fpm_conf_dir)
AC_SUBST(php_fpm_conf_path)
Expand All @@ -55,6 +56,7 @@ AC_DEFINE_UNQUOTED(PHP_FPM_VERSION, "$fpm_version", [fpm version])
AC_DEFINE_UNQUOTED(PHP_FPM_BIN, "$php_fpm_bin", [fpm binary executable])
AC_DEFINE_UNQUOTED(PHP_FPM_BIN_DIR, "$php_fpm_bin_dir", [fpm binary dir])
AC_DEFINE_UNQUOTED(PHP_FPM_BIN_PATH, "$php_fpm_bin_path", [fpm bin file path])
AC_DEFINE_UNQUOTED(PHP_FPM_PORT, "$php_fpm_port", [tcp port])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF, "$php_fpm_conf", [fpm conf file])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_DIR, "$php_fpm_conf_dir", [fpm conf dir])
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_PATH, "$php_fpm_conf_path", [fpm conf file path])
Expand All @@ -69,11 +71,10 @@ AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
AC_CONFIG_FILES([Makefile cgi/Makefile fpm/Makefile])


AC_OUTPUT($php_fpm_conf:conf/php-fpm.conf.in)

AC_OUTPUT(init.d.$php_fpm_bin:conf/init.d.php-fpm.in)

AC_OUTPUT(nginx-site-conf.sample:conf/nginx-site-conf.sample.in)

AC_OUTPUT($php_fpm_bin.1:man/php-fpm.1.in)
AC_OUTPUT( \
$php_fpm_conf:conf/php-fpm.conf.in \
init.d.$php_fpm_bin:conf/init.d.php-fpm.in \
nginx-site-conf.sample:conf/nginx-site-conf.sample.in \
$php_fpm_bin.1:man/php-fpm.1.in \
)

2 changes: 1 addition & 1 deletion man/php-fpm.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
\fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for
Web development and can be embedded into HTML. This is a variant of PHP that will run in the background as a daemon, listening for CGI requests. Output is logged to @php_fpm_log_path@.
.LP
Most options are set in the configuration file. The configuration file is @php_fpm_conf_path@. By default, @php_fpm_bin@ will respond to CGI requests listening on localhost http port 9000. Therefore @php_fpm_bin@ expects your webserver to forward all requests for '.php' files to port 9000 and you should edit your webserver configuration file appropriately.
Most options are set in the xml configuration file @php_fpm_conf_path@. Unless configured otherwise, @php_fpm_bin@ will respond to CGI requests listening on http localhost port 9000 by default. Therefore @php_fpm_bin@ expects your webserver to forward all requests for '.php' files to port 9000 and you should edit your webserver configuration file appropriately.
.SH OPTIONS
.TP 15
.B \-C
Expand Down

0 comments on commit 44504ee

Please sign in to comment.