summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:07 -0400
commitbb01389fbd53ec1cbcb80d0681a37cca1267891a (patch)
tree4783178fca65a5d9071c8df34f2ddc3d31728673 /sapi
parenteddbbea4325e602ddc87c545531609132d4f0e3b (diff)
downloadphp-bb01389fbd53ec1cbcb80d0681a37cca1267891a.tar.gz
Imported Upstream version 5.2.4upstream/5.2.4
Diffstat (limited to 'sapi')
-rw-r--r--sapi/aolserver/config.m416
-rw-r--r--sapi/apache/config.m4239
-rw-r--r--sapi/apache/mod_php5.c24
-rw-r--r--sapi/apache2filter/apache_config.c61
-rw-r--r--sapi/apache2filter/config.m420
-rw-r--r--sapi/apache2handler/apache_config.c10
-rw-r--r--sapi/apache2handler/config.m420
-rw-r--r--sapi/apache2handler/sapi_apache2.c20
-rw-r--r--sapi/apache_hooks/config.m4243
-rw-r--r--sapi/caudium/config.m4170
-rw-r--r--sapi/cgi/cgi_main.c149
-rw-r--r--sapi/cgi/config9.m4110
-rw-r--r--sapi/cgi/fastcgi.c6
-rw-r--r--sapi/cgi/tests/009.phpt6
-rw-r--r--sapi/cli/config.m419
-rw-r--r--sapi/cli/getopt.c17
-rw-r--r--sapi/cli/php_cli.c74
-rw-r--r--sapi/cli/php_cli_readline.c10
-rw-r--r--sapi/cli/tests/015.phpt2
-rw-r--r--sapi/continuity/config.m426
-rw-r--r--sapi/embed/config.m432
-rw-r--r--sapi/embed/php_embed.c46
-rw-r--r--sapi/isapi/config.m437
-rw-r--r--sapi/milter/config.m427
-rw-r--r--sapi/nsapi/config.m424
-rw-r--r--sapi/phttpd/config.m432
-rw-r--r--sapi/pi3web/config.m444
-rw-r--r--sapi/roxen/config.m493
-rw-r--r--sapi/thttpd/config.m426
-rw-r--r--sapi/tux/config.m422
-rw-r--r--sapi/webjames/config.m431
31 files changed, 831 insertions, 825 deletions
diff --git a/sapi/aolserver/config.m4 b/sapi/aolserver/config.m4
index 44eece26a..003ec909d 100644
--- a/sapi/aolserver/config.m4
+++ b/sapi/aolserver/config.m4
@@ -1,15 +1,11 @@
dnl
-dnl $Id: config.m4,v 1.15 2002/03/07 14:19:47 sas Exp $
+dnl $Id: config.m4,v 1.15.22.1 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for AOLserver support)
-AC_ARG_WITH(aolserver,
-[ --with-aolserver=DIR Specify path to the installed AOLserver],[
- PHP_AOLSERVER=$withval
-],[
- PHP_AOLSERVER=no
-])
-AC_MSG_RESULT($PHP_AOLSERVER)
+PHP_ARG_WITH(aolserver,,
+[ --with-aolserver=DIR Specify path to the installed AOLserver], no, no)
+
+AC_MSG_CHECKING([for AOLserver support])
if test "$PHP_AOLSERVER" != "no"; then
if test -d "$PHP_AOLSERVER/include"; then
@@ -28,6 +24,8 @@ if test "$PHP_AOLSERVER" != "no"; then
INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_AOLSERVER/bin/"
fi
+AC_MSG_RESULT([$PHP_AOLSERVER])
+
dnl ## Local Variables:
dnl ## tab-width: 4
dnl ## End:
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index 0e2de950d..0f5ed6bac 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.75 2005/05/29 23:16:45 sniper Exp $
+dnl $Id: config.m4,v 1.75.4.2 2007/07/11 23:20:36 jani Exp $
dnl
AC_DEFUN([PHP_APACHE_FD_CHECK], [
AC_CACHE_CHECK([for member fd in BUFF *],ac_cv_php_fd_in_buff,[
@@ -18,18 +18,22 @@ if test "$ac_cv_php_fd_in_buff" = "yes"; then
fi
])
-AC_MSG_CHECKING(for Apache 1.x module support via DSO through APXS)
-AC_ARG_WITH(apxs,
+dnl Apache 1.x shared module
+PHP_ARG_WITH(apxs,,
[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
- pathname to the Apache apxs tool [apxs]],[
- if test "$withval" = "yes"; then
+ pathname to the Apache apxs tool [apxs]], no, no)
+
+AC_MSG_CHECKING([for Apache 1.x module support via DSO through APXS])
+
+if test "$PHP_APXS" != "no"; then
+ if test "$PHP_APXS" = "yes"; then
APXS=apxs
$APXS -q CFLAGS >/dev/null 2>&1
if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
APXS=/usr/sbin/apxs
fi
else
- PHP_EXPAND_PATH($withval, APXS)
+ PHP_EXPAND_PATH($PHP_APXS, APXS)
fi
$APXS -q CFLAGS >/dev/null 2>&1
@@ -113,141 +117,134 @@ AC_ARG_WITH(apxs,
AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
AC_DEFINE(HAVE_APACHE,1,[ ])
AC_MSG_RESULT(yes)
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
-if test "$PHP_SAPI" != "apache"; then
-AC_MSG_CHECKING(for Apache 1.x module support)
-AC_ARG_WITH(apache,
+dnl Apache 1.x static module
+PHP_ARG_WITH(apache,,
[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
- build directory [/usr/local/apache]],[
+ build directory [/usr/local/apache]], no, no)
- APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php5.* sapi/apache/libphp5.module"
+AC_MSG_CHECKING([for Apache 1.x module support])
- if test "$withval" = "yes"; then
+if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
+
+ if test "$PHP_APACHE" = "yes"; then
# Apache's default directory
- withval=/usr/local/apache
+ PHP_APACHE=/usr/local/apache
fi
- if test "$withval" != "no"; then
- AC_DEFINE(HAVE_APACHE,1,[ ])
- APACHE_MODULE=yes
- PHP_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- # For Apache 2.0.x
- elif test -f $withval/include/httpd.h &&
- test -f $withval/srclib/apr/include/apr_general.h ; then
- AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
+
+ APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php5.* sapi/apache/libphp5.module"
+
+ AC_DEFINE(HAVE_APACHE,1,[ ])
+ APACHE_MODULE=yes
+ PHP_EXPAND_PATH($PHP_APACHE, PHP_APACHE)
+ # For Apache 1.2.x
+ if test -f $PHP_APACHE/src/httpd.h; then
+ APACHE_INCLUDE=-I$PHP_APACHE/src
+ APACHE_TARGET=$PHP_APACHE/src
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
+ PHP_LIBS="-L. -lphp3"
+ AC_MSG_RESULT([yes - Apache 1.2.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE/src/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
+ fi
+ # For Apache 2.0.x
+ elif test -f $PHP_APACHE/include/httpd.h && test -f $PHP_APACHE/srclib/apr/include/apr_general.h ; then
+ AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
+ # For Apache 1.3.x
+ elif test -f $PHP_APACHE/src/main/httpd.h; then
+ APACHE_HAS_REGEX=1
+ APACHE_INCLUDE="-I$PHP_APACHE/src/main -I$PHP_APACHE/src/os/unix -I$PHP_APACHE/src/ap"
+ APACHE_TARGET=$PHP_APACHE/src/modules/php5
+ if test ! -d $APACHE_TARGET; then
+ mkdir $APACHE_TARGET
+ fi
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ AC_MSG_RESULT([yes - Apache 1.3.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE/src/include/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE/src/include/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE="-I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
+ elif test -f $PHP_APACHE/src/include/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
+ fi
+ # Also for Apache 1.3.x
+ elif test -f $PHP_APACHE/src/include/httpd.h; then
+ APACHE_HAS_REGEX=1
+ APACHE_INCLUDE="-I$PHP_APACHE/src/include -I$PHP_APACHE/src/os/unix"
+ APACHE_TARGET=$PHP_APACHE/src/modules/php5
+ if test ! -d $APACHE_TARGET; then
+ mkdir $APACHE_TARGET
+ fi
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ AC_MSG_RESULT([yes - Apache 1.3.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE/src/include/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE/src/include/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
+ elif test -f $PHP_APACHE/src/include/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
+ fi
+ # For StrongHold 2.2
+ elif test -f $PHP_APACHE/apache/httpd.h; then
+ APACHE_INCLUDE="-I$PHP_APACHE/apache -I$PHP_APACHE/ssl/include"
+ APACHE_TARGET=$PHP_APACHE/apache
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
+ STRONGHOLD=-DSTRONGHOLD=1
+ AC_MSG_RESULT([yes - StrongHold])
+ if test -f $PHP_APACHE/apache/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE/src/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
+ elif test -f $PHP_APACHE/src/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
fi
else
AC_MSG_RESULT(no)
+ AC_MSG_ERROR([Invalid Apache directory - unable to find httpd.h under $PHP_APACHE])
fi
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
+# compatibility
+if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
+ enable_mod_charset=$with_mod_charset
fi
+
+PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option,
+[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no)
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache)],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES,1,[ ])
-],[
- AC_MSG_RESULT(no)
-])
+if test "$PHP_MOD_CHARSET" = "yes"; then
+ AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ])
+fi
dnl Build as static module
-if test -n "$APACHE_MODULE"; then
+if test "$APACHE_MODULE" = "yes"; then
PHP_TARGET_RDYNAMIC
$php_shtool mkdir -p sapi/apache
PHP_OUTPUT(sapi/apache/libphp5.module)
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c
index d49901ff9..f5edef0b9 100644
--- a/sapi/apache/mod_php5.c
+++ b/sapi/apache/mod_php5.c
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.19.2.7.2.9 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: mod_php5.c,v 1.19.2.7.2.13 2007/08/06 12:54:57 tony2001 Exp $ */
#include "php_apache_http.h"
#include "http_conf_globals.h"
@@ -80,6 +80,7 @@ typedef struct _php_per_dir_entry {
uint key_length;
uint value_length;
int type;
+ char htaccess;
} php_per_dir_entry;
/* some systems are missing these from their header files */
@@ -174,7 +175,7 @@ static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_head
efree(sapi_header->header);
return 0;
}
-
+
header_name = sapi_header->header;
header_content = p = strchr(header_name, ':');
@@ -547,7 +548,7 @@ static void init_request_info(TSRMLS_D)
*/
static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC)
{
- zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE);
+ zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, per_dir_entry->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE);
return 0;
}
/* }}} */
@@ -764,9 +765,15 @@ static void *php_create_dir(pool *p, char *dummy)
*/
static void *php_merge_dir(pool *p, void *basev, void *addv)
{
- /* This function *must* return addv, and not modify basev */
- zend_hash_merge_ex((HashTable *) addv, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
- return addv;
+ /* This function *must* not modify addv or basev */
+ HashTable *new;
+
+ /* need a copy of addv to merge */
+ new = php_create_dir(p, "php_merge_dir");
+ zend_hash_copy(new, (HashTable *) addv, (copy_ctor_func_t) copy_per_dir_entry, NULL, sizeof(php_per_dir_entry));
+
+ zend_hash_merge_ex(new, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
+ return new;
}
/* }}} */
@@ -785,6 +792,7 @@ static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable
php_apache_startup(&apache_sapi_module);
}
per_dir_entry.type = mode;
+ per_dir_entry.htaccess = ((cmd->override & (RSRC_CONF|ACCESS_CONF)) == 0);
if (strcasecmp(arg2, "none") == 0) {
arg2 = "";
@@ -969,7 +977,7 @@ command_rec php_commands[] =
{"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
{"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"},
{"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"},
- {"PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, TAKE1, "Directory containing the php.ini file"},
+ {"PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, TAKE1, "Directory containing the php.ini file"},
{NULL}
};
/* }}} */
@@ -997,7 +1005,7 @@ module MODULE_VAR_EXPORT php5_module =
, NULL /* header parser */
#endif
#if MODULE_MAGIC_NUMBER >= 19970719
- , NULL /* child_init */
+ , NULL /* child_init */
#endif
#if MODULE_MAGIC_NUMBER >= 19970728
, php_child_exit_handler /* child_exit */
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
index fe43075e8..968ad8bf8 100644
--- a/sapi/apache2filter/apache_config.c
+++ b/sapi/apache2filter/apache_config.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apache_config.c,v 1.34.2.1.2.2 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: apache_config.c,v 1.34.2.1.2.3 2007/08/03 09:33:30 jani Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -35,7 +35,7 @@
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
-#include "http_core.h"
+#include "http_core.h"
#ifdef PHP_AP_DEBUG
#define phpapdebug(a) fprintf a
@@ -51,16 +51,15 @@ typedef struct {
char *value;
size_t value_len;
char status;
+ char htaccess;
} php_dir_entry;
-static const char *real_value_hnd(cmd_parms *cmd, void *dummy,
- const char *name, const char *value, int status)
+static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, const char *value, int status)
{
php_conf_rec *d = dummy;
php_dir_entry e;
- phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy,
- zend_hash_num_elements(&d->config)));
+ phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy, zend_hash_num_elements(&d->config)));
if (!strncasecmp(value, "none", sizeof("none"))) {
value = "";
@@ -69,26 +68,23 @@ static const char *real_value_hnd(cmd_parms *cmd, void *dummy,
e.value = apr_pstrdup(cmd->pool, value);
e.value_len = strlen(value);
e.status = status;
-
- zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e,
- sizeof(e), NULL);
+ e.htaccess = ((cmd->override & (RSRC_CONF|ACCESS_CONF)) == 0);
+
+ zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e), NULL);
return NULL;
}
-static const char *php_apache_value_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
+static const char *php_apache_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
{
return real_value_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
}
-static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
+static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
{
return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
}
-static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1,
- const char *arg2, int status)
+static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2, int status)
{
char bool_val[2];
@@ -102,24 +98,20 @@ static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1,
return real_value_hnd(cmd, dummy, arg1, bool_val, status);
}
-static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
+static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
{
return real_flag_hnd(cmd, dummy, name, value, PHP_INI_PERDIR);
}
-static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy,
- const char *name, const char *value)
+static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
{
return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
}
-static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig,
- const char *arg)
+static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg)
{
if (apache2_php_ini_path_override) {
- return "Only first PHPINIDir directive honored per configuration tree "
- "- subsequent ones ignored";
+ return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored";
}
apache2_php_ini_path_override = ap_server_root_relative(cmd->pool, arg);
return NULL;
@@ -180,8 +172,7 @@ void apply_config(void *dummy)
zend_hash_move_forward(&d->config)) {
zend_hash_get_current_data(&d->config, (void **) &data);
phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, str_len, data->value, data->value_len,
- data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) {
+ if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) {
phpapdebug((stderr, "..FAILED\n"));
}
}
@@ -189,17 +180,12 @@ void apply_config(void *dummy)
const command_rec php_dir_cmds[] =
{
- AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS,
- "PHP Value Modifier"),
- AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS,
- "PHP Flag Modifier"),
- AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL,
- ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"),
- AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL,
- ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"),
- AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF,
- "Directory containing the php.ini file"),
- {NULL}
+ AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"),
+ AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, "PHP Flag Modifier"),
+ AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"),
+ AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"),
+ AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"),
+ {NULL}
};
static apr_status_t destroy_php_config(void *data)
@@ -214,8 +200,7 @@ static apr_status_t destroy_php_config(void *data)
void *create_php_config(apr_pool_t *p, char *dummy)
{
- php_conf_rec *newx =
- (php_conf_rec *) apr_pcalloc(p, sizeof(*newx));
+ php_conf_rec *newx = (php_conf_rec *) apr_pcalloc(p, sizeof(*newx));
phpapdebug((stderr, "Creating new config (%p) for %s\n", newx, dummy));
zend_hash_init(&newx->config, 0, NULL, NULL, 1);
diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4
index c5a0a323d..f9677334a 100644
--- a/sapi/apache2filter/config.m4
+++ b/sapi/apache2filter/config.m4
@@ -1,20 +1,23 @@
dnl
-dnl $Id: config.m4,v 1.41.2.1 2005/09/01 14:33:47 sniper Exp $
+dnl $Id: config.m4,v 1.41.2.1.2.2 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for Apache 2.0 filter-module support via DSO through APXS)
-AC_ARG_WITH(apxs2filter,
+PHP_ARG_WITH(apxs2filter,,
[ --with-apxs2filter[=FILE]
EXPERIMENTAL: Build shared Apache 2.0 Filter module. FILE is the optional
- pathname to the Apache apxs tool [apxs]],[
- if test "$withval" = "yes"; then
+ pathname to the Apache apxs tool [apxs]], no, no)
+
+AC_MSG_CHECKING([for Apache 2.0 filter-module support via DSO through APXS])
+
+if test "$PHP_APXS2FILTER" != "no"; then
+ if test "$PHP_APXS2FILTER" = "yes"; then
APXS=apxs
$APXS -q CFLAGS >/dev/null 2>&1
if test "$?" != "0" && test -x /usr/sbin/apxs; then
APXS=/usr/sbin/apxs
fi
else
- PHP_EXPAND_PATH($withval, APXS)
+ PHP_EXPAND_PATH($PHP_APXS2FILTER, APXS)
fi
$APXS -q CFLAGS >/dev/null 2>&1
@@ -119,11 +122,10 @@ AC_ARG_WITH(apxs2filter,
PHP_BUILD_THREAD_SAFE
fi
AC_MSG_RESULT(yes)
-
PHP_SUBST(APXS)
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
dnl ## Local Variables:
dnl ## tab-width: 4
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index 64bcb0bc1..a214d3693 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apache_config.c,v 1.7.2.1.2.2 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: apache_config.c,v 1.7.2.1.2.4 2007/08/03 09:33:17 jani Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -35,7 +35,7 @@
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
-#include "http_core.h"
+#include "http_core.h"
#ifdef PHP_AP_DEBUG
#define phpapdebug(a) fprintf a
@@ -51,6 +51,7 @@ typedef struct {
char *value;
size_t value_len;
char status;
+ char htaccess;
} php_dir_entry;
static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, const char *value, int status)
@@ -67,7 +68,8 @@ static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name,
e.value = apr_pstrdup(cmd->pool, value);
e.value_len = strlen(value);
e.status = status;
-
+ e.htaccess = ((cmd->override & (RSRC_CONF|ACCESS_CONF)) == 0);
+
zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e), NULL);
return NULL;
}
@@ -170,7 +172,7 @@ void apply_config(void *dummy)
zend_hash_move_forward(&d->config)) {
zend_hash_get_current_data(&d->config, (void **) &data);
phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, PHP_INI_STAGE_ACTIVATE) == FAILURE) {
+ if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) {
phpapdebug((stderr, "..FAILED\n"));
}
}
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 761d466f4..41ace4ef0 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -1,19 +1,22 @@
dnl
-dnl $Id: config.m4,v 1.14.2.1 2005/09/01 14:33:47 sniper Exp $
+dnl $Id: config.m4,v 1.14.2.1.2.2 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for Apache 2.0 handler-module support via DSO through APXS)
-AC_ARG_WITH(apxs2,
+PHP_ARG_WITH(apxs2,,
[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
- pathname to the Apache apxs tool [apxs]],[
- if test "$withval" = "yes"; then
+ pathname to the Apache apxs tool [apxs]], no, no)
+
+AC_MSG_CHECKING([for Apache 2.0 handler-module support via DSO through APXS])
+
+if test "$PHP_APXS2" != "no"; then
+ if test "$PHP_APXS2" = "yes"; then
APXS=apxs
$APXS -q CFLAGS >/dev/null 2>&1
if test "$?" != "0" && test -x /usr/sbin/apxs; then
APXS=/usr/sbin/apxs
fi
else
- PHP_EXPAND_PATH($withval, APXS)
+ PHP_EXPAND_PATH($PHP_APXS2, APXS)
fi
$APXS -q CFLAGS >/dev/null 2>&1
@@ -118,11 +121,10 @@ AC_ARG_WITH(apxs2,
PHP_BUILD_THREAD_SAFE
fi
AC_MSG_RESULT(yes)
-
PHP_SUBST(APXS)
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
dnl ## Local Variables:
dnl ## tab-width: 4
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 56b449c74..3ea83a7f1 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sapi_apache2.c,v 1.57.2.10.2.13 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: sapi_apache2.c,v 1.57.2.10.2.15 2007/06/28 17:23:07 tony2001 Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -349,8 +349,7 @@ static sapi_module_struct apache2_sapi_module = {
STANDARD_SAPI_MODULE_PROPERTIES
};
-static apr_status_t
-php_apache_server_shutdown(void *tmp)
+static apr_status_t php_apache_server_shutdown(void *tmp)
{
apache2_sapi_module.shutdown(&apache2_sapi_module);
sapi_shutdown();
@@ -360,6 +359,15 @@ php_apache_server_shutdown(void *tmp)
return APR_SUCCESS;
}
+static apr_status_t php_apache_child_shutdown(void *tmp)
+{
+ apache2_sapi_module.shutdown(&apache2_sapi_module);
+#if defined(ZTS) && !defined(PHP_WIN32)
+ tsrm_shutdown();
+#endif
+ return APR_SUCCESS;
+}
+
static void php_apache_add_version(apr_pool_t *p)
{
TSRMLS_FETCH();
@@ -651,11 +659,17 @@ zend_first_try {
return OK;
}
+static void php_apache_child_init(apr_pool_t *pchild, server_rec *s)
+{
+ apr_pool_cleanup_register(pchild, NULL, php_apache_child_shutdown, apr_pool_cleanup_null);
+}
+
void php_ap2_register_hook(apr_pool_t *p)
{
ap_hook_pre_config(php_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_handler(php_handler, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_child_init(php_apache_child_init, NULL, NULL, APR_HOOK_MIDDLE);
}
/*
diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4
index 6c9d028e8..12fc9fd50 100644
--- a/sapi/apache_hooks/config.m4
+++ b/sapi/apache_hooks/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.7 2005/05/29 23:16:46 sniper Exp $
+dnl $Id: config.m4,v 1.7.4.2 2007/07/11 23:20:36 jani Exp $
dnl
AC_DEFUN([PHP_APACHE_FD_CHECK], [
AC_CACHE_CHECK([for member fd in BUFF *],ac_cv_php_fd_in_buff,[
@@ -18,19 +18,23 @@ if test "$ac_cv_php_fd_in_buff" = "yes"; then
fi
])
-AC_MSG_CHECKING(for Apache 1.x (hooks) module support via DSO through APXS)
-AC_ARG_WITH(apache-hooks,
+dnl Apache 1.x shared module
+PHP_ARG_WITH(apache-hooks,,
[ --with-apache-hooks[=FILE]
EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
- pathname to the Apache apxs tool [apxs]],[
- if test "$withval" = "yes"; then
+ pathname to the Apache apxs tool [apxs]], no, no)
+
+AC_MSG_CHECKING([for Apache 1.x (hooks) module support via DSO through APXS])
+
+if test "$PHP_APACHE_HOOKS" != "no"; then
+ if test "$PHP_APACHE_HOOKS" = "yes"; then
APXS=apxs
$APXS -q CFLAGS >/dev/null 2>&1
if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
APXS=/usr/sbin/apxs
fi
else
- PHP_EXPAND_PATH($withval, APXS)
+ PHP_EXPAND_PATH($PHP_APACHE_HOOKS, APXS)
fi
$APXS -q CFLAGS >/dev/null 2>&1
@@ -114,142 +118,135 @@ AC_ARG_WITH(apache-hooks,
AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
AC_DEFINE(HAVE_APACHE_HOOKS,1,[ ])
AC_MSG_RESULT(yes)
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
-if test "$PHP_SAPI" != "apache_hooks"; then
-AC_MSG_CHECKING(for Apache 1.x (hooks) module support)
-AC_ARG_WITH(apache-hooks-static,
-[ --with-apache-hooks-static[=DIR]
+dnl Apache 1.x static module
+PHP_ARG_WITH(apache-hooks-static,,
+[ --with-apache-hooks-static[=DIR]
EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
- build directory [/usr/local/apache]],[
+ build directory [/usr/local/apache]], no, no)
+
+AC_MSG_CHECKING(for Apache 1.x (hooks) module support)
- APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php5.* sapi/apache_hooks/libphp5.module"
+if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$PHP_APACHE_HOOKS_STATIC" != "no"; then
- if test "$withval" = "yes"; then
+ if test "$PHP_APACHE_HOOKS_STATIC" = "yes"; then
# Apache's default directory
- withval=/usr/local/apache
+ PHP_APACHE_HOOKS_STATIC=/usr/local/apache
fi
- if test "$withval" != "no"; then
- AC_DEFINE(HAVE_APACHE_HOOKS,1,[ ])
- APACHE_HOOKS_MODULE=yes
- PHP_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- # For Apache 2.0.x
- elif test -f $withval/include/httpd.h &&
- test -f $withval/srclib/apr/include/apr_general.h ; then
- AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php5
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
+
+ APACHE_HOOKS_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php5.* sapi/apache_hooks/libphp5.module"
+
+ AC_DEFINE(HAVE_APACHE,1,[ ])
+ APACHE_HOOKS_MODULE=yes
+ PHP_EXPAND_PATH($PHP_APACHE_HOOKS_STATIC, PHP_APACHE_HOOKS_STATIC)
+ # For Apache 1.2.x
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/httpd.h; then
+ APACHE_INCLUDE=-I$PHP_APACHE_HOOKS_STATIC/src
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
+ PHP_LIBS="-L. -lphp3"
+ AC_MSG_RESULT([yes - Apache 1.2.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
+ fi
+ # For Apache 2.0.x
+ elif test -f $PHP_APACHE_HOOKS_STATIC/include/httpd.h && test -f $PHP_APACHE_HOOKS_STATIC/srclib/apr/include/apr_general.h ; then
+ AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
+ # For Apache 1.3.x
+ elif test -f $PHP_APACHE_HOOKS_STATIC/src/main/httpd.h; then
+ APACHE_HAS_REGEX=1
+ APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/main -I$PHP_APACHE_HOOKS_STATIC/src/os/unix -I$PHP_APACHE_HOOKS_STATIC/src/ap"
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
+ if test ! -d $APACHE_TARGET; then
+ mkdir $APACHE_TARGET
+ fi
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ AC_MSG_RESULT([yes - Apache 1.3.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE="-I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
+ elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
+ fi
+ # Also for Apache 1.3.x
+ elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/httpd.h; then
+ APACHE_HAS_REGEX=1
+ APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/include -I$PHP_APACHE_HOOKS_STATIC/src/os/unix"
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
+ if test ! -d $APACHE_TARGET; then
+ mkdir $APACHE_TARGET
+ fi
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ AC_MSG_RESULT([yes - Apache 1.3.x])
+ STRONGHOLD=
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
+ elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
+ fi
+ # For StrongHold 2.2
+ elif test -f $PHP_APACHE_HOOKS_STATIC/apache/httpd.h; then
+ APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/apache -I$PHP_APACHE_HOOKS_STATIC/ssl/include"
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/apache
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
+ STRONGHOLD=-DSTRONGHOLD=1
+ AC_MSG_RESULT([yes - StrongHold])
+ if test -f $PHP_APACHE_HOOKS_STATIC/apache/ap_config.h; then
+ AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
+ fi
+ if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_compat.h; then
+ AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
+ if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
+ AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
+ elif test -f $PHP_APACHE_HOOKS_STATIC/src/compat.h; then
+ AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
fi
else
AC_MSG_RESULT(no)
+ AC_MSG_ERROR([Invalid Apache directory - unable to find httpd.h under $PHP_APACHE_HOOKS_STATIC])
fi
-],[
+else
AC_MSG_RESULT(no)
-])
+fi
+# compatibility
+if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
+ enable_mod_charset=$with_mod_charset
fi
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache)],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES,1,[ ])
-],[
- AC_MSG_RESULT(no)
-])
+PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option,
+[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no)
+
+if test "$PHP_MOD_CHARSET" = "yes"; then
+ AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ])
+fi
dnl Build as static module
-if test -n "$APACHE_HOOKS_MODULE"; then
+if test "$APACHE_HOOKS_MODULE" = "yes"; then
PHP_TARGET_RDYNAMIC
$php_shtool mkdir -p sapi/apache_hooks
PHP_OUTPUT(sapi/apache_hooks/libphp5.module)
@@ -262,7 +259,7 @@ if test -n "$APACHE_HOOKS_INSTALL"; then
fi
PHP_APACHE_FD_CHECK
- INSTALL_IT=$APACHE_INSTALL
+ INSTALL_IT=$APACHE_HOOKS_INSTALL
PHP_SUBST(APXS_EXP)
PHP_SUBST(APACHE_INCLUDE)
diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4
index f105d0d6f..c1d32d8d7 100644
--- a/sapi/caudium/config.m4
+++ b/sapi/caudium/config.m4
@@ -1,98 +1,98 @@
dnl
-dnl $Id: config.m4,v 1.14.2.1 2005/11/29 18:26:02 tony2001 Exp $
+dnl $Id: config.m4,v 1.14.2.1.2.2 2007/07/11 23:20:36 jani Exp $
dnl
RESULT=no
-AC_MSG_CHECKING(for Caudium support)
-AC_ARG_WITH(caudium,
+PHP_ARG_WITH(caudium,,
[ --with-caudium[=DIR] Build PHP as a Pike module for use with Caudium.
- DIR is the Caudium server dir [/usr/local/caudium/server]],
-[
- if test "$prefix" = "NONE"; then CPREF=/usr/local/; fi
- if test ! -d $withval ; then
- if test "$prefix" = "NONE"; then
- withval=/usr/local/caudium/server/
- else
- withval=$prefix/caudium/server/
- fi
- fi
- if test -f $withval/bin/caudium; then
- PIKE=$withval/bin/caudium
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
- if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- AC_MSG_RESULT(yes)
- PIKE=`echo $PIKE | pike -e 'int tries=100;
- string orig,pike=Stdio.File("stdin")->read()-"\n";
- orig=pike;
- if(search(orig, "/"))
- orig = combine_path(getcwd(), orig);
- while(!catch(pike=readlink(pike)) && tries--)
- ;
- write(combine_path(dirname(orig), pike)); '`
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- if test "$prefix" != "NONE"; then
- PIKE_C_INCLUDE=$prefix/include/`basename $PIKE`
- else
- PIKE_C_INCLUDE=/usr/local/include/`basename $PIKE`
- fi
- AC_MSG_CHECKING(for C includes in $PIKE_C_INCLUDE)
- if test -f $PIKE_C_INCLUDE/version.h; then
- PIKE_TEST_VER=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- ###### VERSION MATCH CHECK #######
- PMAJOR="^#define PIKE_MAJOR_VERSION"
- PMINOR="^#define PIKE_MINOR_VERSION"
- PBUILD="^#define PIKE_BUILD_VERSION"
+ DIR is the Caudium server dir [/usr/local/caudium/server]], no, no)
+
+AC_MSG_CHECKING([for Caudium support])
- PIKE_CMAJOR_VERSION=0
- PIKE_CMINOR_VERSION=0
- PIKE_CBUILD_VERSION=0
+if test "$PHP_CAUDIUM" != "no"; then
+ if test "$prefix" = "NONE"; then CPREF=/usr/local/; fi
+ if test ! -d $PHP_CAUDIUM ; then
+ if test "$prefix" = "NONE"; then
+ PHP_CAUDIUM=/usr/local/caudium/server/
+ else
+ PHP_CAUDIUM=$prefix/caudium/server/
+ fi
+ fi
+ if test -f $PHP_CAUDIUM/bin/caudium; then
+ PIKE=$PHP_CAUDIUM/bin/caudium
+ elif test -f $PHP_CAUDIUM/bin/pike; then
+ PIKE=$PHP_CAUDIUM/bin/pike
+ else
+ AC_MSG_ERROR([Could not find a pike in $PHP_CAUDIUM/bin/])
+ fi
+ if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
+ PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
+ PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
+ if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
+ AC_MSG_ERROR(Failed to figure out Pike module and include directories)
+ fi
+ AC_MSG_RESULT(yes)
+ PIKE=`echo $PIKE | pike -e 'int tries=100;
+ string orig,pike=Stdio.File("stdin")->read()-"\n";
+ orig=pike;
+ if(search(orig, "/"))
+ orig = combine_path(getcwd(), orig);
+ while(!catch(pike=readlink(pike)) && tries--)
+ ;
+ write(combine_path(dirname(orig), pike)); '`
+ PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
+ if test "$prefix" != "NONE"; then
+ PIKE_C_INCLUDE=$prefix/include/`basename $PIKE`
+ else
+ PIKE_C_INCLUDE=/usr/local/include/`basename $PIKE`
+ fi
+ AC_MSG_CHECKING([for C includes in $PIKE_C_INCLUDE])
+ if test -f $PIKE_C_INCLUDE/version.h; then
+ PIKE_TEST_VER=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
+ ###### VERSION MATCH CHECK #######
+ PMAJOR="^#define PIKE_MAJOR_VERSION"
+ PMINOR="^#define PIKE_MINOR_VERSION"
+ PBUILD="^#define PIKE_BUILD_VERSION"
- PIKE_CMAJOR_VERSION=`grep "$PMAJOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- if test -z "$PIKE_CMAJOR_VERSION"; then
- if test -n "`grep f_version $PIKE_C_INCLUDE/version.h`"; then
- PIKE_CMAJOR_VERSION=6
- fi
- else
- PIKE_CMINOR_VERSION=`grep "$PMINOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- PIKE_CBUILD_VERSION=`grep "$PBUILD" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- fi
-
- if test "$PIKE_TEST_VER" = "${PIKE_CMAJOR_VERSION}.${PIKE_CMINOR_VERSION}.${PIKE_CBUILD_VERSION}"; then
- PHP_ADD_INCLUDE($PIKE_C_INCLUDE)
- PIKE_INCLUDE_DIR="$PIKE_INCLUDE_DIR, $PIKE_C_INCLUDE"
- AC_MSG_RESULT(found)
- else
- AC_MSG_RESULT(version mismatch)
- fi
- else
- AC_MSG_RESULT(not found)
- fi
- else
- AC_MSG_ERROR(Caudium PHP5 requires Pike 7.0 or newer)
- fi
- PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
- PHP_SELECT_SAPI(caudium, shared, caudium.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP5.so"
- RESULT=" *** Pike binary used: $PIKE
- *** Pike include dir(s) used: $PIKE_INCLUDE_DIR
- *** Pike version: $PIKE_VERSION"
- dnl Always use threads since thread-free support really blows.
- PHP_BUILD_THREAD_SAFE
+ PIKE_CMAJOR_VERSION=0
+ PIKE_CMINOR_VERSION=0
+ PIKE_CBUILD_VERSION=0
-])
+ PIKE_CMAJOR_VERSION=`grep "$PMAJOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
+ if test -z "$PIKE_CMAJOR_VERSION"; then
+ if test -n "`grep f_version $PIKE_C_INCLUDE/version.h`"; then
+ PIKE_CMAJOR_VERSION=6
+ fi
+ else
+ PIKE_CMINOR_VERSION=`grep "$PMINOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
+ PIKE_CBUILD_VERSION=`grep "$PBUILD" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
+ fi
+
+ if test "$PIKE_TEST_VER" = "${PIKE_CMAJOR_VERSION}.${PIKE_CMINOR_VERSION}.${PIKE_CBUILD_VERSION}"; then
+ PHP_ADD_INCLUDE($PIKE_C_INCLUDE)
+ PIKE_INCLUDE_DIR="$PIKE_INCLUDE_DIR, $PIKE_C_INCLUDE"
+ AC_MSG_RESULT(found)
+ else
+ AC_MSG_RESULT(version mismatch)
+ fi
+ else
+ AC_MSG_RESULT(not found)
+ fi
+ else
+ AC_MSG_ERROR([Caudium PHP5 requires Pike 7.0 or newer])
+ fi
+ PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
+ AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
+ PHP_SELECT_SAPI(caudium, shared, caudium.c)
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_CAUDIUM/lib/$PIKE_VERSION/PHP5.so"
+ RESULT=" *** Pike binary used: $PIKE
+ *** Pike include dir(s) used: $PIKE_INCLUDE_DIR
+ *** Pike version: $PIKE_VERSION"
+ dnl Always use threads since thread-free support really blows.
+ PHP_BUILD_THREAD_SAFE
+fi
AC_MSG_RESULT($RESULT)
dnl ## Local Variables:
dnl ## tab-width: 4
dnl ## End:
-
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index fd0af132a..559ea1f46 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.267.2.15.2.40 2007/05/28 08:11:59 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.46 2007/08/08 23:51:57 stas Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -522,16 +522,29 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
{
- unsigned int new_val_len;
- char *val = SG(request_info).request_uri ? SG(request_info).request_uri : "";
+ char *script_name = SG(request_info).request_uri;
+ unsigned int script_name_len = script_name ? strlen(script_name) : 0;
+ char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC);
+ unsigned int path_info_len = path_info ? strlen(path_info) : 0;
+ unsigned int php_self_len = script_name_len + path_info_len;
+ char *php_self = emalloc(php_self_len + 1);
+
+ if (script_name) {
+ memcpy(php_self, script_name, script_name_len + 1);
+ }
+ if (path_info) {
+ memcpy(php_self + script_name_len, path_info, path_info_len + 1);
+ }
+
/* In CGI mode, we consider the environment to be a part of the server
* variables
*/
php_import_environment_variables(track_vars_array TSRMLS_CC);
/* Build the special-case PHP_SELF variable for the CGI version */
- if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &val, strlen(val), &new_val_len TSRMLS_CC)) {
- php_register_variable_safe("PHP_SELF", val, new_val_len, track_vars_array TSRMLS_CC);
+ if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) {
+ php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC);
}
+ efree(php_self);
}
static void sapi_cgi_log_message(char *message)
@@ -766,7 +779,7 @@ static void init_request_info(TSRMLS_D)
char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);
if (CGIG(fix_pathinfo)) {
- char *real_path;
+ char *real_path = NULL;
char *orig_path_translated = env_path_translated;
char *orig_path_info = env_path_info;
char *orig_script_name = env_script_name;
@@ -830,7 +843,21 @@ static void init_request_info(TSRMLS_D)
if (orig_path_info != path_info) {
if (orig_path_info) {
+ char old;
+
_sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
+ old = path_info[0];
+ path_info[0] = 0;
+ if (!orig_script_name ||
+ strcmp(orig_script_name, env_path_info) != 0) {
+ if (orig_script_name) {
+ _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
+ }
+ SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_path_info TSRMLS_CC);
+ } else {
+ SG(request_info).request_uri = orig_script_name;
+ }
+ path_info[0] = old;
}
env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC);
}
@@ -847,8 +874,7 @@ static void init_request_info(TSRMLS_D)
SCRIPT_FILENAME minus SCRIPT_NAME
*/
- if (env_document_root)
- {
+ if (env_document_root) {
int l = strlen(env_document_root);
int path_translated_len = 0;
char *path_translated = NULL;
@@ -860,12 +886,9 @@ static void init_request_info(TSRMLS_D)
/* we have docroot, so we should have:
* DOCUMENT_ROOT=/docroot
* SCRIPT_FILENAME=/docroot/info.php
- *
- * SCRIPT_NAME is the portion of the path beyond docroot
*/
- env_script_name = pt + l;
- /* PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO */
+ /* PATH_TRANSLATED = DOCUMENT_ROOT + PATH_INFO */
path_translated_len = l + (env_path_info ? strlen(env_path_info) : 0);
path_translated = (char *) emalloc(path_translated_len + 1);
memcpy(path_translated, env_document_root, l);
@@ -881,7 +904,7 @@ static void init_request_info(TSRMLS_D)
} else if (env_script_name &&
strstr(pt, env_script_name)
) {
- /* PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO */
+ /* PATH_TRANSLATED = PATH_TRANSLATED - SCRIPT_NAME + PATH_INFO */
int ptlen = strlen(pt) - strlen(env_script_name);
int path_translated_len = ptlen + env_path_info ? strlen(env_path_info) : 0;
char *path_translated = NULL;
@@ -913,35 +936,47 @@ static void init_request_info(TSRMLS_D)
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", NULL TSRMLS_CC);
SG(sapi_headers).http_response_code = 404;
}
- if (!orig_script_name ||
- strcmp(orig_script_name, env_script_name) != 0) {
- if (orig_script_name) {
- _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
+ if (!SG(request_info).request_uri) {
+ if (!orig_script_name ||
+ strcmp(orig_script_name, env_script_name) != 0) {
+ if (orig_script_name) {
+ _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
+ }
+ SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC);
+ } else {
+ SG(request_info).request_uri = orig_script_name;
}
- SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC);
- } else {
- SG(request_info).request_uri = orig_script_name;
- }
+ }
if (pt) {
efree(pt);
}
+ /* some server configurations allow '..' to slip through in the
+ translated path. We'll just refuse to handle such a path. */
+ if (script_path_translated && !strstr(script_path_translated, "..")) {
+ SG(request_info).path_translated = estrdup(script_path_translated);
+ }
} else {
+ if (real_path) {
+ script_path_translated = real_path;
+ }
/* make sure path_info/translated are empty */
if (!orig_script_filename ||
- (script_path_translated != orig_script_filename) ||
- strcmp(script_path_translated, orig_script_filename) != 0) {
+ (script_path_translated != orig_script_filename &&
+ strcmp(script_path_translated, orig_script_filename) != 0)) {
if (orig_script_filename) {
_sapi_cgibin_putenv("ORIG_SCRIPT_FILENAME", orig_script_filename TSRMLS_CC);
}
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", script_path_translated TSRMLS_CC);
}
- if (orig_path_info) {
- _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
- }
- if (orig_path_translated) {
- _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
+ if (env_redirect_url) {
+ if (orig_path_info) {
+ _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
+ }
+ if (orig_path_translated) {
+ _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
+ }
}
if (env_script_name != orig_script_name) {
if (orig_script_name) {
@@ -951,8 +986,15 @@ static void init_request_info(TSRMLS_D)
} else {
SG(request_info).request_uri = env_script_name;
}
- }
- free(real_path);
+ /* some server configurations allow '..' to slip through in the
+ translated path. We'll just refuse to handle such a path. */
+ if (script_path_translated && !strstr(script_path_translated, "..")) {
+ SG(request_info).path_translated = estrdup(script_path_translated);
+ }
+ if (real_path) {
+ free(real_path);
+ }
+ }
} else {
#endif
/* pre 4.3 behaviour, shouldn't be used but provides BC */
@@ -962,20 +1004,21 @@ static void init_request_info(TSRMLS_D)
SG(request_info).request_uri = env_script_name;
}
#if !DISCARD_PATH
- if (env_path_translated)
+ if (env_path_translated) {
script_path_translated = env_path_translated;
+ }
#endif
+ /* some server configurations allow '..' to slip through in the
+ translated path. We'll just refuse to handle such a path. */
+ if (script_path_translated && !strstr(script_path_translated, "..")) {
+ SG(request_info).path_translated = estrdup(script_path_translated);
+ }
#if ENABLE_PATHINFO_CHECK
}
#endif
SG(request_info).request_method = sapi_cgibin_getenv("REQUEST_METHOD", sizeof("REQUEST_METHOD")-1 TSRMLS_CC);
/* FIXME - Work out proto_num here */
SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING")-1 TSRMLS_CC);
- /* some server configurations allow '..' to slip through in the
- translated path. We'll just refuse to handle such a path. */
- if (script_path_translated && !strstr(script_path_translated, "..")) {
- SG(request_info).path_translated = estrdup(script_path_translated);
- }
SG(request_info).content_type = (content_type ? content_type : "" );
SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
@@ -1118,10 +1161,6 @@ int main(int argc, char *argv[])
/* end of temporary locals */
#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
void ***tsrm_ls;
#endif
@@ -1161,6 +1200,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
+ tsrm_ls = ts_resource(0);
#endif
sapi_startup(&cgi_sapi_module);
@@ -1252,11 +1292,6 @@ int main(int argc, char *argv[])
php_optarg = orig_optarg;
#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
SG(request_info).path_translated = NULL;
#endif
@@ -1682,7 +1717,9 @@ consult the installation file that came with this distribution, or visit \n\
*/
retval = FAILURE;
if (cgi || SG(request_info).path_translated) {
- retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
+ if (!php_check_open_basedir(SG(request_info).path_translated TSRMLS_CC)) {
+ retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
+ }
}
/*
if we are unable to open path_translated and we are not
@@ -1704,9 +1741,21 @@ consult the installation file that came with this distribution, or visit \n\
goto fastcgi_request_done;
}
#endif
+
+ STR_FREE(SG(request_info).path_translated);
+
+ if (free_query_string && SG(request_info).query_string) {
+ free(SG(request_info).query_string);
+ SG(request_info).query_string = NULL;
+ }
+
php_request_shutdown((void *) 0);
SG(server_context) = NULL;
php_module_shutdown(TSRMLS_C);
+ sapi_shutdown();
+#ifdef ZTS
+ tsrm_shutdown();
+#endif
return FAILURE;
}
@@ -1820,6 +1869,10 @@ fastcgi_request_done:
if (bindpath) {
free(bindpath);
}
+ if (max_requests != 1) {
+ /* no need to return exit_status of the last request */
+ exit_status = 0;
+ }
break;
}
/* end of fastcgi loop */
diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
index bd04b0cf3..26ed76618 100644
--- a/sapi/cgi/config9.m4
+++ b/sapi/cgi/config9.m4
@@ -1,61 +1,37 @@
dnl
-dnl $Id: config9.m4,v 1.17.2.2.2.4 2007/05/24 23:29:59 sniper Exp $
+dnl $Id: config9.m4,v 1.17.2.2.2.6 2007/07/11 23:20:36 jani Exp $
dnl
-AC_ARG_ENABLE(cgi,
-[ --disable-cgi Disable building CGI version of PHP],
-[
- PHP_SAPI_CGI=$enableval
-],[
- PHP_SAPI_CGI=yes
-])
+PHP_ARG_ENABLE(cgi,,
+[ --disable-cgi Disable building CGI version of PHP], yes, no)
-AC_ARG_ENABLE(force-cgi-redirect,
-[ --enable-force-cgi-redirect
- CGI: Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache],
-[
- PHP_FORCE_CGI_REDIRECT=$enableval
-],[
- PHP_FORCE_CGI_REDIRECT=no
-])
+PHP_ARG_ENABLE(fastcgi,,
+[ --enable-fastcgi CGI: Enable FastCGI support in the CGI binary], no, no)
-AC_ARG_ENABLE(discard-path,
-[ --enable-discard-path CGI: If 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],
-[
- PHP_DISCARD_PATH=$enableval
-],[
- PHP_DISCARD_PATH=no
-])
+PHP_ARG_ENABLE(force-cgi-redirect,,
+[ --enable-force-cgi-redirect
+ CGI: Enable security check for internal server
+ redirects. Use this if you run the PHP CGI with Apache], no, no)
-AC_ARG_ENABLE(fastcgi,
-[ --enable-fastcgi CGI: If this is enabled, the cgi module will
- be built with support for fastcgi also],
-[
- PHP_ENABLE_FASTCGI=$enableval
-],[
- PHP_ENABLE_FASTCGI=no
-])
+PHP_ARG_ENABLE(discard-path,,
+[ --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], no, no)
-AC_ARG_ENABLE(path-info-check,
+PHP_ARG_ENABLE(path-info-check,,
[ --disable-path-info-check CGI: If this is disabled, paths such as
- /info.php/test?a=b will fail to work],
-[
- PHP_ENABLE_PATHINFO_CHECK=$enableval
-],[
- PHP_ENABLE_PATHINFO_CHECK=yes
-])
+ /info.php/test?a=b will fail to work], yes, no)
+dnl
+dnl CGI setup
+dnl
if test "$PHP_SAPI" = "default"; then
- AC_MSG_CHECKING(for CGI build)
- if test "$PHP_SAPI_CGI" != "no"; then
+ AC_MSG_CHECKING(whether to build CGI binary)
+ if test "$PHP_CGI" != "no"; then
AC_MSG_RESULT(yes)
-
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
+
+ dnl Set filename
case $host_alias in
*cygwin* )
SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
@@ -66,16 +42,29 @@ if test "$PHP_SAPI" = "default"; then
esac
PHP_SUBST(SAPI_CGI_PATH)
+ dnl --enable-fastcgi
+ AC_MSG_CHECKING(whether to enable fastcgi support)
+ if test "$PHP_FASTCGI" = "yes"; then
+ PHP_ENABLE_FASTCGI=1
+ PHP_FCGI_FILES="fastcgi.c"
+ else
+ PHP_ENABLE_FASTCGI=0
+ PHP_FCGI_FILES=
+ fi
+ AC_DEFINE_UNQUOTED(PHP_FASTCGI, $PHP_ENABLE_FASTCGI, [ ])
+ AC_MSG_RESULT($PHP_FASTCGI)
+
+ dnl --enable-force-cgi-redirect
AC_MSG_CHECKING(whether to force Apache CGI redirect)
if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then
- REDIRECT=1
+ CGI_REDIRECT=1
else
- REDIRECT=0
+ CGI_REDIRECT=0
fi
- AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT,$REDIRECT,[ ])
+ AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT, $CGI_REDIRECT, [ ])
AC_MSG_RESULT($PHP_FORCE_CGI_REDIRECT)
-
+ dnl --enable-discard-path
AC_MSG_CHECKING(whether to discard path_info + path_translated)
if test "$PHP_DISCARD_PATH" = "yes"; then
DISCARD_PATH=1
@@ -85,28 +74,19 @@ if test "$PHP_SAPI" = "default"; then
AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ])
AC_MSG_RESULT($PHP_DISCARD_PATH)
+ dnl --enable-path-info-check
AC_MSG_CHECKING(whether to enable path info checking)
- if test "$PHP_ENABLE_PATHINFO_CHECK" = "yes"; then
+ if test "$PHP_PATH_INFO_CHECK" = "yes"; then
ENABLE_PATHINFO_CHECK=1
else
ENABLE_PATHINFO_CHECK=0
fi
AC_DEFINE_UNQUOTED(ENABLE_PATHINFO_CHECK, $ENABLE_PATHINFO_CHECK, [ ])
- AC_MSG_RESULT($PHP_ENABLE_PATHINFO_CHECK)
-
- AC_MSG_CHECKING(whether to enable fastcgi support)
- if test "$PHP_ENABLE_FASTCGI" = "yes"; then
- PHP_FASTCGI=1
- PHP_FCGI_FILES="fastcgi.c"
- else
- PHP_FASTCGI=0
- PHP_FCGI_FILES=""
- fi
- AC_DEFINE_UNQUOTED(PHP_FASTCGI, $PHP_FASTCGI, [ ])
- AC_MSG_RESULT($PHP_ENABLE_FASTCGI)
+ AC_MSG_RESULT($PHP_PATH_INFO_CHECK)
+ dnl Set install target and select SAPI
INSTALL_IT="@echo \"Installing PHP CGI binary: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
- PHP_SELECT_SAPI(cgi, program, $PHP_FCGI_FILES cgi_main.c getopt.c, , '$(SAPI_CGI_PATH)')
+ PHP_SELECT_SAPI(cgi, program, $PHP_FCGI_FILES cgi_main.c getopt.c,, '$(SAPI_CGI_PATH)')
case $host_alias in
*aix*)
@@ -122,7 +102,7 @@ if test "$PHP_SAPI" = "default"; then
PHP_SUBST(BUILD_CGI)
- elif test "$PHP_SAPI_CLI" != "no"; then
+ elif test "$PHP_CLI" != "no"; then
AC_MSG_RESULT(no)
OVERALL_TARGET=
PHP_SAPI=cli
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
index a0064888f..143b35e69 100644
--- a/sapi/cgi/fastcgi.c
+++ b/sapi/cgi/fastcgi.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fastcgi.c,v 1.4.2.13.2.26 2007/05/21 09:08:13 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.4.2.13.2.27 2007/07/09 11:48:39 dmitry Exp $ */
#include "php.h"
#include "fastcgi.h"
@@ -927,7 +927,11 @@ int fcgi_accept_request(fcgi_request *req)
}
}
+#ifdef _WIN32
if (req->fd < 0 && (in_shutdown || errno != EINTR)) {
+#else
+ if (req->fd < 0 && (in_shutdown || (errno != EINTR && errno != ECONNABORTED))) {
+#endif
return -1;
}
diff --git a/sapi/cgi/tests/009.phpt b/sapi/cgi/tests/009.phpt
index c92fc87a8..1c429ac19 100644
--- a/sapi/cgi/tests/009.phpt
+++ b/sapi/cgi/tests/009.phpt
@@ -14,11 +14,13 @@ $f = tempnam(sys_get_temp_dir(), 'cgitest');
putenv("TRANSLATED_PATH=".$f."/x");
putenv("SCRIPT_FILENAME=".$f."/x");
-file_put_contents($f, '<?php var_dump($_SERVER["TRANSLATED_PATH"]); ');
+file_put_contents($f, '<?php var_dump($_SERVER["TRANSLATED_PATH"]); ?>');
-echo (`$php $f`);
+echo (`$php -n $f`);
echo "Done\n";
+
+@unlink($f);
?>
--EXPECTF--
X-Powered-By: PHP/%s
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index c38db2fcc..4ea165c46 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -1,19 +1,13 @@
dnl
-dnl $Id: config.m4,v 1.22.2.1 2006/02/02 09:59:23 dmitry Exp $
+dnl $Id: config.m4,v 1.22.2.1.2.1 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for CLI build)
-
-AC_ARG_ENABLE(cli,
+PHP_ARG_ENABLE(cli,,
[ --disable-cli Disable building CLI version of PHP
- (this forces --without-pear)],
-[
- PHP_SAPI_CLI=$enableval
-],[
- PHP_SAPI_CLI=yes
-])
+ (this forces --without-pear)], yes, no)
-if test "$PHP_SAPI_CLI" != "no"; then
+AC_MSG_CHECKING(for CLI build)
+if test "$PHP_CLI" != "no"; then
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag,$abs_srcdir/sapi/cli,sapi/cli)
SAPI_CLI_PATH=sapi/cli/php
PHP_SUBST(SAPI_CLI_PATH)
@@ -38,5 +32,4 @@ if test "$PHP_SAPI_CLI" != "no"; then
PHP_SUBST(INSTALL_CLI)
PHP_OUTPUT(sapi/cli/php.1)
fi
-
-AC_MSG_RESULT($PHP_SAPI_CLI)
+AC_MSG_RESULT($PHP_CLI)
diff --git a/sapi/cli/getopt.c b/sapi/cli/getopt.c
index fd665d7d3..450de55af 100644
--- a/sapi/cli/getopt.c
+++ b/sapi/cli/getopt.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: getopt.c,v 1.8.2.1.2.5 2007/04/23 11:05:16 tony2001 Exp $ */
+/* $Id: getopt.c,v 1.8.2.1.2.6 2007/06/04 09:47:54 tony2001 Exp $ */
#include <stdio.h>
#include <string.h>
@@ -28,7 +28,7 @@
#define OPTERRARG (3)
-static int php_opt_error(int argc, char * const *argv, int oint, int optchr, int err, int show_err)
+static int php_opt_error(int argc, char * const *argv, int oint, int optchr, int err, int show_err) /* {{{ */
{
if (show_err)
{
@@ -51,8 +51,9 @@ static int php_opt_error(int argc, char * const *argv, int oint, int optchr, int
}
return('?');
}
+/* }}} */
-int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err)
+int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err) /* {{{ */
{
static int optchr = 0;
static int dash = 0; /* have already seen the - */
@@ -162,3 +163,13 @@ int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **opta
assert(0);
return(0); /* never reached */
}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: sw=4 ts=4 fdm=marker
+ * vim<600: sw=4 ts=4
+ */
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 03af8de50..c441835f1 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_cli.c,v 1.129.2.13.2.20 2007/05/06 12:57:50 johannes Exp $ */
+/* $Id: php_cli.c,v 1.129.2.13.2.22 2007/08/08 23:51:24 stas Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -164,13 +164,14 @@ static const opt_struct OPTIONS[] = {
{'-', 0, NULL} /* end of args */
};
-static int print_module_info(zend_module_entry *module TSRMLS_DC)
+static int print_module_info(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
php_printf("%s\n", module->name);
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
-static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC) /* {{{ */
{
Bucket *f = *((Bucket **) a);
Bucket *s = *((Bucket **) b);
@@ -178,8 +179,9 @@ static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
return strcasecmp(((zend_module_entry *)f->pData)->name,
((zend_module_entry *)s->pData)->name);
}
+/* }}} */
-static void print_modules(TSRMLS_D)
+static void print_modules(TSRMLS_D) /* {{{ */
{
HashTable sorted_registry;
zend_module_entry tmp;
@@ -190,21 +192,23 @@ static void print_modules(TSRMLS_D)
zend_hash_apply(&sorted_registry, (apply_func_t) print_module_info TSRMLS_CC);
zend_hash_destroy(&sorted_registry);
}
+/* }}} */
-static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
+static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC) /* {{{ */
{
php_printf("%s\n", ext->name);
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
-static int extension_name_cmp(const zend_llist_element **f,
- const zend_llist_element **s TSRMLS_DC)
+static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s TSRMLS_DC) /* {{{ */
{
return strcmp(((zend_extension *)(*f)->data)->name,
((zend_extension *)(*s)->data)->name);
}
+/* }}} */
-static void print_extensions(TSRMLS_D)
+static void print_extensions(TSRMLS_D) /* {{{ */
{
zend_llist sorted_exts;
@@ -214,12 +218,13 @@ static void print_extensions(TSRMLS_D)
zend_llist_apply(&sorted_exts, (llist_apply_func_t) print_extension_info TSRMLS_CC);
zend_llist_destroy(&sorted_exts);
}
+/* }}} */
#ifndef STDOUT_FILENO
#define STDOUT_FILENO 1
#endif
-static inline size_t sapi_cli_single_write(const char *str, uint str_length)
+static inline size_t sapi_cli_single_write(const char *str, uint str_length) /* {{{ */
{
#ifdef PHP_WRITE_STDOUT
long ret;
@@ -236,8 +241,9 @@ static inline size_t sapi_cli_single_write(const char *str, uint str_length)
return ret;
#endif
}
+/* }}} */
-static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC)
+static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */
{
const char *ptr = str;
uint remaining = str_length;
@@ -266,9 +272,9 @@ static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC)
return str_length;
}
+/* }}} */
-
-static void sapi_cli_flush(void *server_context)
+static void sapi_cli_flush(void *server_context) /* {{{ */
{
/* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR streams
* are/could be closed before fflush() is called.
@@ -279,11 +285,12 @@ static void sapi_cli_flush(void *server_context)
#endif
}
}
+/* }}} */
static char *php_self = "";
static char *script_filename = "";
-static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC)
+static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */
{
/* In CGI mode, we consider the environment to be a part of the server
* variables
@@ -299,14 +306,15 @@ static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC)
/* just make it available */
php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC);
}
+/* }}} */
-
-static void sapi_cli_log_message(char *message)
+static void sapi_cli_log_message(char *message) /* {{{ */
{
fprintf(stderr, "%s\n", message);
}
+/* }}} */
-static int sapi_cli_deactivate(TSRMLS_D)
+static int sapi_cli_deactivate(TSRMLS_D) /* {{{ */
{
fflush(stdout);
if(SG(request_info).argv0) {
@@ -315,40 +323,44 @@ static int sapi_cli_deactivate(TSRMLS_D)
}
return SUCCESS;
}
+/* }}} */
-static char* sapi_cli_read_cookies(TSRMLS_D)
+static char* sapi_cli_read_cookies(TSRMLS_D) /* {{{ */
{
return NULL;
}
+/* }}} */
-static int sapi_cli_header_handler(sapi_header_struct *h, sapi_headers_struct *s TSRMLS_DC)
+static int sapi_cli_header_handler(sapi_header_struct *h, sapi_headers_struct *s TSRMLS_DC) /* {{{ */
{
/* free allocated header line */
efree(h->header);
/* avoid pushing headers into SAPI headers list */
return 0;
}
+/* }}} */
-static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
+static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) /* {{{ */
{
/* We do nothing here, this function is needed to prevent that the fallback
* header handling is called. */
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
+/* }}} */
-static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
+static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC) /* {{{ */
{
}
+/* }}} */
-
-static int php_cli_startup(sapi_module_struct *sapi_module)
+static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
{
if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
return FAILURE;
}
return SUCCESS;
}
-
+/* }}} */
/* {{{ sapi_cli_ini_defaults */
@@ -468,7 +480,7 @@ static void php_cli_usage(char *argv0)
static php_stream *s_in_process = NULL;
-static void cli_register_file_handles(TSRMLS_D)
+static void cli_register_file_handles(TSRMLS_D) /* {{{ */
{
zval *zin, *zout, *zerr;
php_stream *s_in, *s_out, *s_err;
@@ -530,6 +542,7 @@ static void cli_register_file_handles(TSRMLS_D)
FREE_ZVAL(zout);
FREE_ZVAL(zerr);
}
+/* }}} */
static const char *param_mode_conflict = "Either execute direct code, process stdin or use a file.\n";
@@ -594,10 +607,6 @@ int main(int argc, char *argv[])
int hide_argv = 0;
/* end of temporary locals */
#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
void ***tsrm_ls;
#endif
#ifdef PHP_CLI_WIN32_NO_CONSOLE
@@ -635,6 +644,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
+ tsrm_ls = ts_resource(0);
#endif
cli_sapi_module.ini_defaults = sapi_cli_ini_defaults;
@@ -703,14 +713,6 @@ int main(int argc, char *argv[])
cli_sapi_module.executable_location = argv[0];
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- tsrm_ls = ts_resource(0);
-#endif
-
/* startup after we get the above ini override se we get things right */
if (cli_sapi_module.startup(&cli_sapi_module)==FAILURE) {
/* there is no way to see if we must call zend_ini_deactivate()
diff --git a/sapi/cli/php_cli_readline.c b/sapi/cli/php_cli_readline.c
index 06903a7db..c0f5d1a1a 100644
--- a/sapi/cli/php_cli_readline.c
+++ b/sapi/cli/php_cli_readline.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_cli_readline.c,v 1.3.2.5.2.2 2007/02/24 02:17:28 helly Exp $ */
+/* $Id: php_cli_readline.c,v 1.3.2.5.2.3 2007/06/04 09:47:54 tony2001 Exp $ */
#include "php.h"
@@ -59,8 +59,6 @@
#include "zend_highlight.h"
#include "zend_indent.h"
-/* {{{ cli_is_valid_code
- */
typedef enum {
body,
sstring,
@@ -74,7 +72,7 @@ typedef enum {
outside,
} php_code_type;
-int cli_is_valid_code(char *code, int len, char **prompt TSRMLS_DC)
+int cli_is_valid_code(char *code, int len, char **prompt TSRMLS_DC) /* {{{ */
{
int valid_end = 1, last_valid_end;
int brackets_count = 0;
@@ -430,9 +428,7 @@ TODO:
return retval;
} /* }}} */
-/* {{{ cli_code_completion
- */
-char **cli_code_completion(const char *text, int start, int end)
+char **cli_code_completion(const char *text, int start, int end) /* {{{ */
{
return rl_completion_matches(text, cli_completion_generator);
}
diff --git a/sapi/cli/tests/015.phpt b/sapi/cli/tests/015.phpt
index be501d471..4d5226759 100644
--- a/sapi/cli/tests/015.phpt
+++ b/sapi/cli/tests/015.phpt
@@ -31,5 +31,5 @@ Array
)
PHP %d.%d.%d%s(cli) (built: %s)%s
-Usage: php [options] [-f] <file> [--] [args...]
+Usage: %s [options] [-f] <file> [--] [args...]
Done
diff --git a/sapi/continuity/config.m4 b/sapi/continuity/config.m4
index 15fded246..b22ac5bd3 100644
--- a/sapi/continuity/config.m4
+++ b/sapi/continuity/config.m4
@@ -1,36 +1,28 @@
-dnl ## $Id: config.m4,v 1.3 2005/05/29 23:16:46 sniper Exp $ -*- sh -*-
+dnl ## $Id: config.m4,v 1.3.4.1 2007/07/11 23:20:36 jani Exp $ -*- sh -*-
-AC_MSG_CHECKING(for Continuity support)
-AC_ARG_WITH(continuity,
+PHP_ARG_WITH(continuity, for Continuity support,
[ --with-continuity=DIR Build PHP as Continuity Server module.
- DIR is path to the installed Continuity Server root],[
- PHP_CONTINUITY=$withval
-],[
- PHP_CONTINUITY=no
-])
-AC_MSG_RESULT($PHP_CONTINUITY)
+ DIR is path to the installed Continuity Server root], no, no)
if test "$PHP_CONTINUITY" != "no"; then
-
if test ! -d $PHP_CONTINUITY; then
- AC_MSG_ERROR(Please specify the path to the root of your Continuity server using --with-continuity=DIR)
+ AC_MSG_ERROR([Please specify the path to the root of your Continuity server using --with-continuity=DIR])
fi
- AC_MSG_CHECKING(for Continuity include files)
+ AC_MSG_CHECKING([for Continuity include files])
if test -d $PHP_CONTINUITY/include ; then
CAPI_INCLUDE=$PHP_CONTINUITY/include
- AC_MSG_RESULT(Continuity Binary Distribution)
+ AC_MSG_RESULT([Continuity Binary Distribution])
else
- AC_MSG_ERROR(Cannot find your CAPI include files in either DIR/src or DIR/include)
+ AC_MSG_ERROR([Cannot find your CAPI include files in either DIR/src or DIR/include])
fi
- PHP_SELECT_SAPI(continuity,shared,capi.c)
+ PHP_SELECT_SAPI(continuity, shared, capi.c)
PHP_ADD_INCLUDE($CAPI_INCLUDE)
PHP_BUILD_THREAD_SAFE
- AC_DEFINE(HAVE_CONTINUITY,1,[Whether you have a Continuity Server])
+ AC_DEFINE(HAVE_CONTINUITY, 1, [Whether you have a Continuity Server])
INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_CONTINUITY/lib/"
fi
-
dnl ## Local Variables:
dnl ## tab-width: 4
dnl ## End:
diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4
index 52740e6e9..a02cdd215 100644
--- a/sapi/embed/config.m4
+++ b/sapi/embed/config.m4
@@ -1,14 +1,15 @@
dnl
-dnl $Id: config.m4,v 1.9 2005/05/07 02:51:53 sniper Exp $
+dnl $Id: config.m4,v 1.9.4.2 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for embedded SAPI library support)
-
-AC_ARG_ENABLE(embed,
+PHP_ARG_ENABLE(embed,,
[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
- TYPE is either 'shared' or 'static'. [TYPE=shared]],
-[
- case $enableval in
+ TYPE is either 'shared' or 'static'. [TYPE=shared]], no, no)
+
+AC_MSG_CHECKING([for embedded SAPI library support])
+
+if test "$PHP_EMBED" != "no"; then
+ case "$PHP_EMBED" in
yes|shared)
PHP_EMBED_TYPE=shared
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)\$(prefix)/lib"
@@ -21,13 +22,12 @@ AC_ARG_ENABLE(embed,
PHP_EMBED_TYPE=no
;;
esac
-],[
- PHP_EMBED_TYPE=no
-])
-
-AC_MSG_RESULT($PHP_EMBED_TYPE)
-
-if test "$PHP_EMBED_TYPE" != "no"; then
- PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c)
- PHP_INSTALL_HEADERS([sapi/embed/php_embed.h])
+ if test "$PHP_EMBED_TYPE" != "no"; then
+ PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c)
+ PHP_INSTALL_HEADERS([sapi/embed/php_embed.h])
+ fi
+ AC_MSG_RESULT([$PHP_EMBED_TYPE])
+else
+ AC_MSG_RESULT(no)
fi
+
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 4d8326789..cb50b219d 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -15,7 +15,7 @@
| Author: Edin Kadribasic <edink@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_embed.c,v 1.11.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */
+/* $Id: php_embed.c,v 1.11.2.1.2.5 2007/08/08 21:57:30 stas Exp $ */
#include "php_embed.h"
@@ -24,6 +24,14 @@
#include <fcntl.h>
#endif
+#define HARDCODED_INI \
+ "html_errors=0\n" \
+ "register_argc_argv=1\n" \
+ "implicit_flush=1\n" \
+ "output_buffering=0\n" \
+ "max_execution_time=0\n" \
+ "max_input_time=-1\n"
+
static char* php_embed_read_cookies(TSRMLS_D)
{
return NULL;
@@ -135,12 +143,9 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
{
zend_llist global_vars;
#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
- void ***tsrm_ls;
+ void ***tsrm_ls = NULL;
#endif
+ int ini_entries_len = 0;
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
@@ -162,36 +167,29 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
-#endif
-
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
tsrm_ls = ts_resource(0);
*ptsrm_ls = tsrm_ls;
#endif
+ ini_entries_len = strlen(HARDCODED_INI);
+ php_embed_module.ini_entries = malloc(ini_entries_len+2);
+ memcpy(php_embed_module.ini_entries, HARDCODED_INI, ini_entries_len+1);
+ php_embed_module.ini_entries[ini_entries_len+1] = 0;
+
sapi_startup(&php_embed_module);
- if (php_embed_module.startup(&php_embed_module)==FAILURE) {
- return FAILURE;
- }
-
if (argv) {
php_embed_module.executable_location = argv[0];
}
+ if (php_embed_module.startup(&php_embed_module)==FAILURE) {
+ return FAILURE;
+ }
+
zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
/* Set some Embedded PHP defaults */
SG(options) |= SAPI_OPTION_NO_CHDIR;
- zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
SG(request_info).argc=argc;
SG(request_info).argv=argv;
@@ -215,6 +213,10 @@ void php_embed_shutdown(TSRMLS_D)
#ifdef ZTS
tsrm_shutdown();
#endif
+ if (php_embed_module.ini_entries) {
+ free(php_embed_module.ini_entries);
+ php_embed_module.ini_entries = NULL;
+ }
}
/*
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
index 7d98c9852..acf383114 100644
--- a/sapi/isapi/config.m4
+++ b/sapi/isapi/config.m4
@@ -1,26 +1,23 @@
dnl
-dnl $Id: config.m4,v 1.17 2005/05/29 23:16:46 sniper Exp $
+dnl $Id: config.m4,v 1.17.4.3 2007/07/11 23:20:36 jani Exp $
dnl
-RESULT=no
-AC_MSG_CHECKING(for Zeus ISAPI support)
-AC_ARG_WITH(isapi,
-[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus],
-[
- if test "$withval" = "yes"; then
- ZEUSPATH=/usr/local/zeus # the default
- else
- ZEUSPATH=$withval
- fi
- test -f "$ZEUSPATH/web/include/httpext.h" || AC_MSG_ERROR(Unable to find httpext.h in $ZEUSPATH/web/include)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_ZEUS,1,[ ])
- PHP_ADD_INCLUDE($ZEUSPATH/web/include)
- PHP_SELECT_SAPI(isapi, shared, php5isapi.c)
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
+PHP_ARG_WITH(isapi, for Zeus ISAPI support,
+[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no)
+
+if test "$PHP_ISAPI" != "no"; then
+ if test "$PHP_ISAPI" = "yes"; then
+ ZEUSPATH=/usr/local/zeus # the default
+ else
+ ZEUSPATH=$PHP_ISAPI
+ fi
+ test -f "$ZEUSPATH/web/include/httpext.h" || AC_MSG_ERROR(Unable to find httpext.h in $ZEUSPATH/web/include)
+ PHP_BUILD_THREAD_SAFE
+ AC_DEFINE(WITH_ZEUS, 1, [ ])
+ PHP_ADD_INCLUDE($ZEUSPATH/web/include)
+ PHP_SELECT_SAPI(isapi, shared, php5isapi.c)
+ INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/"
+fi
dnl ## Local Variables:
dnl ## tab-width: 4
diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4
index 1b65b3d45..a34563ae6 100644
--- a/sapi/milter/config.m4
+++ b/sapi/milter/config.m4
@@ -1,39 +1,32 @@
dnl
-dnl $Id: config.m4,v 1.6 2003/10/03 05:24:31 sniper Exp $
+dnl $Id: config.m4,v 1.6.6.2 2007/07/11 23:20:36 jani Exp $
dnl
-AC_MSG_CHECKING(for Milter support)
-AC_ARG_WITH(milter,
-[ --with-milter[=DIR] Build PHP as Milter application],[
- if test "$withval" = "yes"; then
+PHP_ARG_WITH(milter, for Milter support,
+[ --with-milter[=DIR] Build PHP as Milter application], no, no)
+
+if test "$PHP_MILTER" != "no"; then
+ if test "$PHP_MILTER" = "yes"; then
if test -f /usr/lib/libmilter.a ; then
MILTERPATH=/usr/lib
else
if test -f /usr/lib/libmilter/libmilter.a ; then
MILTERPATH=/usr/lib/libmilter
else
- AC_MSG_ERROR(Unable to find libmilter.a)
+ AC_MSG_ERROR([Unable to find libmilter.a])
fi
fi
else
- MILTERPATH=$withval
+ MILTERPATH=$PHP_MILTER
fi
SAPI_MILTER_PATH=sapi/milter/php-milter
- PHP_SUBST(SAPI_MILTER_PATH)
PHP_BUILD_THREAD_SAFE
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/milter/Makefile.frag)
-
PHP_SELECT_SAPI(milter, program, php_milter.c getopt.c,,'$(SAPI_MILTER_PATH)')
PHP_ADD_LIBRARY_WITH_PATH(milter, $MILTERPATH,)
-
BUILD_MILTER="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_MILTER_PATH)"
-
INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_MILTER_PATH) \$(bindir)/php-milter"
- RESULT=yes
-
+ PHP_SUBST(SAPI_MILTER_PATH)
PHP_SUBST(BUILD_MILTER)
-],[
- RESULT=no
-])
-AC_MSG_RESULT($RESULT)
+fi
diff --git a/sapi/nsapi/config.m4 b/sapi/nsapi/config.m4
index d5d599f46..a117438ab 100644
--- a/sapi/nsapi/config.m4
+++ b/sapi/nsapi/config.m4
@@ -1,40 +1,34 @@
dnl
-dnl $Id: config.m4,v 1.17.6.1 2006/10/27 07:23:44 thetaphi Exp $
+dnl $Id: config.m4,v 1.17.6.2 2007/07/11 23:20:37 jani Exp $
dnl
-AC_MSG_CHECKING(for NSAPI support)
-AC_ARG_WITH(nsapi,
-[ --with-nsapi=DIR Build PHP as NSAPI module for Netscape/iPlanet/Sun Webserver],[
- PHP_NSAPI=$withval
-],[
- PHP_NSAPI=no
-])
-AC_MSG_RESULT($PHP_NSAPI)
+PHP_ARG_WITH(nsapi, for NSAPI support,
+[ --with-nsapi=DIR Build PHP as NSAPI module for Netscape/iPlanet/Sun Webserver], no, no)
if test "$PHP_NSAPI" != "no"; then
if test ! -d $PHP_NSAPI/bin ; then
AC_MSG_ERROR(Please specify the path to the root of your Netscape/iPlanet/Sun Webserver using --with-nsapi=DIR)
fi
- AC_MSG_CHECKING(for NSAPI include files)
+ AC_MSG_CHECKING([for NSAPI include files])
if test -d $PHP_NSAPI/include ; then
NSAPI_INC_DIR="$PHP_NSAPI/include"
- AC_MSG_RESULT(Netscape 3.x / Sun 7.x style)
+ AC_MSG_RESULT([Netscape 3.x / Sun 7.x style])
AC_CHECK_HEADERS([$NSAPI_INC_DIR/nsapi.h])
NSAPI_INCLUDE="-I$NSAPI_INC_DIR"
fi
if test -d $PHP_NSAPI/plugins/include ; then
NSAPI_INC_DIR="$PHP_NSAPI/plugins/include"
- AC_MSG_RESULT(iPlanet 4.x / Sun 6.x style)
+ AC_MSG_RESULT([iPlanet 4.x / Sun 6.x style])
AC_CHECK_HEADERS([$NSAPI_INC_DIR/nsapi.h])
NSAPI_INCLUDE="$NSAPI_INCLUDE -I$NSAPI_INC_DIR"
fi
- if test "$NSAPI_INCLUDE" = ""; then
- AC_MSG_ERROR(Please check you have nsapi.h in either $PHP_NSAPI/include or $PHP_NSAPI/plugins/include)
+ if test -z "$NSAPI_INCLUDE"; then
+ AC_MSG_ERROR([Please check you have nsapi.h in either $PHP_NSAPI/include or $PHP_NSAPI/plugins/include])
fi
PHP_EVAL_INCLINE($NSAPI_INCLUDE)
PHP_BUILD_THREAD_SAFE
- AC_DEFINE(HAVE_NSAPI,1,[Whether you have a Netscape/iPlanet/Sun Webserver])
+ AC_DEFINE(HAVE_NSAPI, 1, [Whether you have a Netscape/iPlanet/Sun Webserver])
PHP_SELECT_SAPI(nsapi, shared, nsapi.c)
INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_NSAPI/bin/"
fi
diff --git a/sapi/phttpd/config.m4 b/sapi/phttpd/config.m4
index cff319954..ca5cd80a5 100644
--- a/sapi/phttpd/config.m4
+++ b/sapi/phttpd/config.m4
@@ -1,24 +1,20 @@
dnl
-dnl $Id: config.m4,v 1.7 2002/03/07 14:19:53 sas Exp $
+dnl $Id: config.m4,v 1.7.22.3 2007/07/11 23:20:37 jani Exp $
dnl
-RESULT=no
-AC_MSG_CHECKING(for PHTTPD support)
-AC_ARG_WITH(phttpd,
-[ --with-phttpd=DIR Build PHP as phttpd module],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- PHP_BUILD_THREAD_SAFE
- PHTTPD_DIR=$withval
- PHP_ADD_INCLUDE($PHTTPD_DIR/include)
- AC_DEFINE(HAVE_PHTTPD,1,[Whether you have phttpd])
- PHP_SELECT_SAPI(phttpd, shared, phttpd.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHTTPD_DIR/modules/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
+PHP_ARG_WITH(phttpd, for PHTTPD support,
+[ --with-phttpd=DIR Build PHP as phttpd module], no, no)
+
+if test "$PHP_PHTTPD" != "no"; then
+ if test ! -d $PHP_PHTTPD ; then
+ AC_MSG_ERROR([You did not specify a directory])
+ fi
+ PHP_BUILD_THREAD_SAFE
+ PHP_ADD_INCLUDE($PHP_PHTTPD/include)
+ AC_DEFINE(HAVE_PHTTPD, 1, [Whether you have phttpd])
+ PHP_SELECT_SAPI(phttpd, shared, phttpd.c)
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_PHTTPD/modules/"
+fi
dnl ## Local Variables:
dnl ## tab-width: 4
diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4
index b3d3dffae..633d7bb7a 100644
--- a/sapi/pi3web/config.m4
+++ b/sapi/pi3web/config.m4
@@ -1,34 +1,26 @@
dnl
-dnl $Id: config.m4,v 1.10 2004/01/17 13:00:15 sniper Exp $
+dnl $Id: config.m4,v 1.10.6.2 2007/07/11 23:20:37 jani Exp $
dnl
-RESULT=no
-AC_MSG_CHECKING(for Pi3Web support)
+PHP_ARG_WITH(pi3web, for Pi3Web support,
+[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no)
-AC_ARG_WITH(pi3web,
-[ --with-pi3web[=DIR] Build PHP as Pi3Web module],
-[
-if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- PI3PATH=../.. # the default
- else
- PI3PATH=$withval
- fi
- test -f "$PI3PATH/PiAPI/PiAPI.h" || AC_MSG_ERROR(Unable to find PiAPI.h in $PI3PATH/PiAPI)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_PI3WEB,1,[whether you want Pi3Web support])
- PHP_ADD_INCLUDE($PI3PATH/PiAPI)
- PHP_ADD_INCLUDE($PI3PATH/Pi2API)
- PHP_ADD_INCLUDE($PI3PATH/Pi3API)
- PHP_ADD_INCLUDE($PI3PATH/PHP5)
- PHP_SELECT_SAPI(pi3web, shared, pi3web_sapi.c)
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/"
- RESULT=yes
-else
- RESULT=no
+if test "$PHP_PI3WEB" != "no"; then
+ if test "$PHP_PI3WEB" = "yes"; then
+ PI3PATH=../.. # the default
+ else
+ PI3PATH=$PHP_PI3WEB
+ fi
+ test -f "$PI3PATH/PiAPI/PiAPI.h" || AC_MSG_ERROR([Unable to find PiAPI.h in $PI3PATH/PiAPI])
+ PHP_BUILD_THREAD_SAFE
+ AC_DEFINE(WITH_PI3WEB, 1, [whether you want Pi3Web support])
+ PHP_ADD_INCLUDE($PI3PATH/PiAPI)
+ PHP_ADD_INCLUDE($PI3PATH/Pi2API)
+ PHP_ADD_INCLUDE($PI3PATH/Pi3API)
+ PHP_ADD_INCLUDE($PI3PATH/PHP5)
+ PHP_SELECT_SAPI(pi3web, shared, pi3web_sapi.c)
+ INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/"
fi
-])
-AC_MSG_RESULT($RESULT)
dnl ## Local Variables:
dnl ## tab-width: 4
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
index 2ba1965cc..1e32d94b7 100644
--- a/sapi/roxen/config.m4
+++ b/sapi/roxen/config.m4
@@ -1,60 +1,55 @@
dnl
-dnl $Id: config.m4,v 1.17.2.1 2005/11/29 18:26:02 tony2001 Exp $
+dnl $Id: config.m4,v 1.17.2.1.2.2 2007/07/11 23:20:37 jani Exp $
dnl
-RESULT=no
-AC_MSG_CHECKING(for Roxen/Pike support)
-AC_ARG_WITH(roxen,
+PHP_ARG_WITH(roxen,,
[ --with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
- directory, normally /usr/local/roxen/server],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- if test -f $withval/bin/roxen; then
- PIKE=$withval/bin/roxen
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; catch(v = __VERSION__ + (__BUILD__/10000.0)); if(v < 0.7079) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,'`
- if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- else
- AC_MSG_ERROR(Roxen/PHP requires Pike 0.7.79 or newer)
- fi
-
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- AC_DEFINE(HAVE_ROXEN,1,[Whether you use Roxen])
- PHP_SELECT_SAPI(roxen, shared, roxen.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP5.so"
- RESULT="yes
- Pike binary used: $PIKE
- Pike include dir: $PIKE_INCLUDE_DIR
- Pike module directory: $PIKE_MODULE_DIR"
- PIKE_INCLUDE_DIR=" -I$PIKE_INCLUDE_DIR "
-])
-AC_MSG_RESULT($RESULT)
+ directory, normally /usr/local/roxen/server], no, no)
+
+PHP_ARG_ENABLE(roxen-zts, whether Roxen module is build using ZTS,
+[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no)
-if test "$RESULT" != "no" ; then
- RESULT=no
- AC_MSG_CHECKING(if Roxen should use ZTS)
- AC_ARG_ENABLE(roxen-zts,
- [ --enable-roxen-zts Build the Roxen module using Zend Thread Safety],
- [
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(ROXEN_USE_ZTS,1,[Whether to use Roxen in ZTS mode])
- RESULT=yes
+RESULT=
+AC_MSG_CHECKING([for Roxen/Pike support])
+if test "$PHP_ROXEN" != "no"; then
+ if test ! -d $PHP_ROXEN ; then
+ AC_MSG_ERROR([You did not specify a directory])
+ fi
+ if test -f $PHP_ROXEN/bin/roxen; then
+ PIKE=$PHP_ROXEN/bin/roxen
+ elif test -f $PHP_ROXEN/bin/pike; then
+ PIKE=$PHP_ROXEN/bin/pike
+ else
+ AC_MSG_ERROR([Could not find a pike in $PHP_ROXEN/bin/])
+ fi
+
+ if $PIKE -e 'float v; catch(v = __VERSION__ + (__BUILD__/10000.0)); if(v < 0.7079) exit(1); exit(0);'; then
+ PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
+ PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,'`
+ if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
+ AC_MSG_ERROR([Failed to figure out Pike module and include directories])
+ fi
+ else
+ AC_MSG_ERROR([Roxen/PHP requires Pike 0.7.79 or newer])
+ fi
+
+ PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
+ AC_DEFINE(HAVE_ROXEN, 1, [Whether you use Roxen])
+ PHP_SELECT_SAPI(roxen, shared, roxen.c)
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP5.so"
+ RESULT="yes
+ Pike binary used: $PIKE
+ Pike include dir: $PIKE_INCLUDE_DIR
+ Pike module directory: $PIKE_MODULE_DIR"
+ PIKE_INCLUDE_DIR=" -I$PIKE_INCLUDE_DIR "
- ])
- AC_MSG_RESULT($RESULT)
+ if test "$PHP_ROXEN_ZTS" != "no"; then
+ PHP_BUILD_THREAD_SAFE
+ AC_DEFINE(ROXEN_USE_ZTS, 1, [Whether to use Roxen in ZTS mode])
+ fi
fi
+AC_MSG_RESULT([$RESULT])
dnl ## Local Variables:
dnl ## tab-width: 4
dnl ## End:
-
diff --git a/sapi/thttpd/config.m4 b/sapi/thttpd/config.m4
index 551790e33..c0500b86e 100644
--- a/sapi/thttpd/config.m4
+++ b/sapi/thttpd/config.m4
@@ -1,20 +1,24 @@
dnl
-dnl $Id: config.m4,v 1.23 2004/01/17 13:00:16 sniper Exp $
+dnl $Id: config.m4,v 1.23.6.2 2007/07/11 23:20:37 jani Exp $
dnl
-AC_ARG_WITH(thttpd,
-[ --with-thttpd=SRCDIR Build PHP as thttpd module],[
- if test ! -d $withval; then
- AC_MSG_RESULT(thttpd directory does not exist ($withval))
+PHP_ARG_WITH(thttpd,,
+[ --with-thttpd=SRCDIR Build PHP as thttpd module], no, no)
+
+AC_MSG_CHECKING([for thttpd])
+
+if test "$PHP_THTTPD" != "no"; then
+ if test ! -d $PHP_THTTPD; then
+ AC_MSG_RESULT(thttpd directory does not exist ($PHP_THTTPD))
fi
- PHP_EXPAND_PATH($withval, THTTPD)
+ PHP_EXPAND_PATH($PHP_THTTPD, THTTPD)
- if grep thttpd.2.21b $withval/version.h >/dev/null; then
+ if grep thttpd.2.21b $PHP_THTTPD/version.h >/dev/null; then
patch="test -f $THTTPD/php_patched || \
(cd $THTTPD && patch -p1 < $abs_srcdir/sapi/thttpd/thttpd_patch && touch php_patched)"
- elif grep Premium $withval/version.h >/dev/null; then
+ elif grep Premium $PHP_THTTPD/version.h >/dev/null; then
patch=
else
AC_MSG_ERROR([This version only supports thttpd-2.21b and Premium thttpd])
@@ -31,9 +35,5 @@ AC_ARG_WITH(thttpd,
PHP_THTTPD="yes, using $THTTPD"
PHP_ADD_INCLUDE($THTTPD)
PHP_SELECT_SAPI(thttpd, static)
-],[
- PHP_THTTPD=no
-])
-
-AC_MSG_CHECKING(for thttpd)
+fi
AC_MSG_RESULT($PHP_THTTPD)
diff --git a/sapi/tux/config.m4 b/sapi/tux/config.m4
index 38c5b0d9a..323318534 100644
--- a/sapi/tux/config.m4
+++ b/sapi/tux/config.m4
@@ -1,18 +1,16 @@
dnl
-dnl $Id: config.m4,v 1.4 2004/01/17 13:00:17 sniper Exp $
+dnl $Id: config.m4,v 1.4.6.2 2007/07/11 23:20:37 jani Exp $
dnl
-PHP_TUX=no
+PHP_ARG_WITH(tux,,
+[ --with-tux=MODULEDIR Build PHP as a TUX module (Linux only)], no, no)
-AC_ARG_WITH(tux,
-[ --with-tux=MODULEDIR Build PHP as a TUX module (Linux only)],[
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/php5.tux.so"
+AC_MSG_CHECKING([for TUX])
+if test "$PHP_TUX" != "no"; then
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_TUX/php5.tux.so"
AC_CHECK_HEADERS(tuxmodule.h,[:],[AC_MSG_ERROR([Cannot find tuxmodule.h])])
PHP_SELECT_SAPI(tux, shared, php_tux.c)
- PHP_TUX=yes
-])
-
-AC_MSG_CHECKING(for TUX)
-AC_MSG_RESULT($PHP_TUX)
-
-unset PHP_TUX
+ AC_MSG_RESULT([$PHP_TUX])
+else
+ AC_MSG_RESULT(no)
+fi
diff --git a/sapi/webjames/config.m4 b/sapi/webjames/config.m4
index a12a37646..351781a61 100644
--- a/sapi/webjames/config.m4
+++ b/sapi/webjames/config.m4
@@ -1,20 +1,21 @@
dnl
-dnl $Id: config.m4,v 1.5 2002/03/24 22:57:00 alexwaugh Exp $
+dnl $Id: config.m4,v 1.5.22.2 2007/07/11 23:20:37 jani Exp $
dnl
-AC_ARG_WITH(webjames,
-[ --with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only)],[
- PHP_EXPAND_PATH($withval, WEBJAMES)
+PHP_ARG_WITH(webjames,,
+[ --with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only)], no, no)
+
+AC_MSG_CHECKING([for webjames])
+
+if test "$PHP_WEBJAMES" != "no"; then
+ PHP_EXPAND_PATH($PHP_WEBJAMES, PHP_WEBJAMES)
INSTALL_IT="\
- echo 'PHP_LIBS = -l$abs_srcdir/$SAPI_STATIC \$(PHP_LIBS) \$(EXTRA_LIBS)' > $WEBJAMES/build/php; \
- echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $WEBJAMES/build/php; \
- echo 'PHP_CFLAGS = -DPHP \$(COMMON_FLAGS) \$(EXTRA_CFLAGS) -I$abs_srcdir/sapi/webjames' >> $WEBJAMES/build/php;"
- PHP_WEBJAMES="yes, using $WEBJAMES"
- PHP_ADD_INCLUDE($WEBJAMES)
+ echo 'PHP_LIBS = -l$abs_srcdir/$SAPI_STATIC \$(PHP_LIBS) \$(EXTRA_LIBS)' > $PHP_WEBJAMES/build/php; \
+ echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $PHP_WEBJAMES/build/php; \
+ echo 'PHP_CFLAGS = -DPHP \$(COMMON_FLAGS) \$(EXTRA_CFLAGS) -I$abs_srcdir/sapi/webjames' >> $PHP_WEBJAMES/build/php;"
+ PHP_ADD_INCLUDE($PHP_WEBJAMES)
PHP_SELECT_SAPI(webjames, static, webjames.c)
-],[
- PHP_WEBJAMES="no"
-])
-
-AC_MSG_CHECKING(for webjames)
-AC_MSG_RESULT($PHP_WEBJAMES)
+ AC_MSG_RESULT([yes, using $PHP_WEBJAMES])
+else
+ AC_MSG_RESULT(no)
+fi