summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/apache/config.m46
-rw-r--r--sapi/apache2handler/config.m42
-rw-r--r--sapi/apache_hooks/config.m42
-rw-r--r--sapi/caudium/config.m42
-rw-r--r--sapi/cgi/cgi_main.c11
-rw-r--r--sapi/cli/config.m419
-rw-r--r--sapi/cli/config.w324
-rw-r--r--sapi/cli/php_cli.c18
-rw-r--r--sapi/cli/php_cli_process_title.c80
-rw-r--r--sapi/cli/php_cli_process_title.h43
-rw-r--r--sapi/cli/php_cli_server.c191
-rw-r--r--sapi/cli/php_cli_server.h1
-rw-r--r--sapi/cli/ps_title.c437
-rw-r--r--sapi/cli/ps_title.h42
-rw-r--r--sapi/cli/tests/bug64544.phpt20
-rw-r--r--sapi/cli/tests/cli_process_title_unix.phpt49
-rw-r--r--sapi/cli/tests/cli_process_title_windows.phpt83
-rw-r--r--sapi/cli/tests/php_cli_server_011.phpt41
-rw-r--r--sapi/cli/tests/php_cli_server_013.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_019.phpt68
-rw-r--r--sapi/embed/config.m42
-rw-r--r--sapi/fpm/config.m412
-rw-r--r--sapi/fpm/fpm/fastcgi.c2
-rw-r--r--sapi/fpm/fpm/fpm_sockets.h2
-rw-r--r--sapi/fpm/php-fpm.conf.in4
-rw-r--r--sapi/isapi/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c1297
-rw-r--r--sapi/litespeed/lsapilib.c47
-rw-r--r--sapi/litespeed/lsapilib.h5
-rw-r--r--sapi/milter/config.m42
-rw-r--r--sapi/pi3web/config.m42
-rw-r--r--sapi/roxen/config.m42
33 files changed, 1602 insertions, 904 deletions
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index 1961289de0..7b0ee562eb 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -20,7 +20,7 @@ fi
dnl Apache 1.x shared module
PHP_ARG_WITH(apxs,,
-[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
+[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
pathname to the Apache apxs tool [apxs]], no, no)
AC_MSG_CHECKING([for Apache 1.x module support via DSO through APXS])
@@ -123,7 +123,7 @@ fi
dnl Apache 1.x static module
PHP_ARG_WITH(apache,,
-[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
+[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
build directory [/usr/local/apache]], no, no)
AC_MSG_CHECKING([for Apache 1.x module support])
@@ -237,7 +237,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
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)
+[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no)
if test "$PHP_MOD_CHARSET" = "yes"; then
AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ])
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 753de10ba8..02f8a0b3ad 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_WITH(apxs2,,
-[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
+[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
pathname to the Apache apxs tool [apxs]], no, no)
AC_MSG_CHECKING([for Apache 2.0 handler-module support via DSO through APXS])
diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4
index 672f298084..e2c71b4274 100644
--- a/sapi/apache_hooks/config.m4
+++ b/sapi/apache_hooks/config.m4
@@ -239,7 +239,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
fi
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)
+[ --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, [ ])
diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4
index 8aba33e23d..5ce55f3f01 100644
--- a/sapi/caudium/config.m4
+++ b/sapi/caudium/config.m4
@@ -4,7 +4,7 @@ dnl
RESULT=no
PHP_ARG_WITH(caudium,,
-[ --with-caudium[=DIR] Build PHP as a Pike module for use 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]], no, no)
AC_MSG_CHECKING([for Caudium support])
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index b8ff878fe4..b1e12f7324 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -884,7 +884,6 @@ static int sapi_cgi_activate(TSRMLS_D)
} else {
doc_root = getenv("DOCUMENT_ROOT");
}
-
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
doc_root_len = strlen(doc_root);
@@ -1689,8 +1688,8 @@ static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS
PHP_FUNCTION(apache_response_headers) /* {{{ */
{
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
}
if (!&SG(sapi_headers).headers) {
@@ -1956,7 +1955,11 @@ consult the installation file that came with this distribution, or visit \n\
}
if (bindpath) {
- fcgi_fd = fcgi_listen(bindpath, 128);
+ int backlog = 128;
+ if (getenv("PHP_FCGI_BACKLOG")) {
+ backlog = atoi(getenv("PHP_FCGI_BACKLOG"));
+ }
+ fcgi_fd = fcgi_listen(bindpath, backlog);
if (fcgi_fd < 0) {
fprintf(stderr, "Couldn't create FastCGI listen socket on port %s\n", bindpath);
#ifdef ZTS
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index cdfa1f7daf..9a1b98da46 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -6,6 +6,23 @@ PHP_ARG_ENABLE(cli,,
[ --disable-cli Disable building CLI version of PHP
(this forces --without-pear)], yes, no)
+AC_CHECK_FUNCS(setproctitle)
+
+AC_CHECK_HEADERS([sys/pstat.h])
+
+AC_CACHE_CHECK([for PS_STRINGS], [cli_cv_var_PS_STRINGS],
+[AC_TRY_LINK(
+[#include <machine/vmparam.h>
+#include <sys/exec.h>
+],
+[PS_STRINGS->ps_nargvstr = 1;
+PS_STRINGS->ps_argvstr = "foo";],
+[cli_cv_var_PS_STRINGS=yes],
+[cli_cv_var_PS_STRINGS=no])])
+if test "$cli_cv_var_PS_STRINGS" = yes ; then
+ AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS thing exists.])
+fi
+
AC_MSG_CHECKING(for CLI build)
if test "$PHP_CLI" != "no"; then
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cli/Makefile.frag)
@@ -14,7 +31,7 @@ if test "$PHP_CLI" != "no"; then
SAPI_CLI_PATH=sapi/cli/php
dnl Select SAPI
- PHP_SELECT_SAPI(cli, program, php_cli.c php_http_parser.c php_cli_server.c,, '$(SAPI_CLI_PATH)')
+ PHP_SELECT_SAPI(cli, program, php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c,, '$(SAPI_CLI_PATH)')
case $host_alias in
*aix*)
diff --git a/sapi/cli/config.w32 b/sapi/cli/config.w32
index 4d0dad58e8..adcbb2b496 100644
--- a/sapi/cli/config.w32
+++ b/sapi/cli/config.w32
@@ -6,7 +6,7 @@ ARG_ENABLE('crt-debug', 'Enable CRT memory dumps for debugging sent to STDERR',
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c php_cli_process_title.c ps_title.c', 'php.exe');
ADD_FLAG("LIBS_CLI", "ws2_32.lib");
if (PHP_CRT_DEBUG == "yes") {
ADD_FLAG("CFLAGS_CLI", "/D PHP_WIN32_DEBUG_HEAP");
@@ -15,7 +15,7 @@ if (PHP_CLI == "yes") {
}
if (PHP_CLI_WIN32 == "yes") {
- SAPI('cli_win32', 'cli_win32.c', 'php-win.exe');
+ SAPI('cli_win32', 'cli_win32.c php_cli_process_title.c ps_title.c', 'php-win.exe');
ADD_FLAG("LDFLAGS_CLI_WIN32", "/stack:8388608");
}
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 07371ee8e3..9daa382eec 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -86,6 +86,9 @@
#include "php_cli_server.h"
#endif
+#include "ps_title.h"
+#include "php_cli_process_title.h"
+
#ifndef PHP_WIN32
# define php_select(m, r, w, e, t) select(m, r, w, e, t)
#else
@@ -478,6 +481,8 @@ ZEND_END_ARG_INFO()
static const zend_function_entry additional_functions[] = {
ZEND_FE(dl, arginfo_dl)
+ PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
+ PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
{NULL, NULL, NULL}
};
@@ -1201,6 +1206,7 @@ int main(int argc, char *argv[])
int argc = __argc;
char **argv = __argv;
#endif
+
int c;
int exit_status = SUCCESS;
int module_started = 0, sapi_started = 0;
@@ -1212,6 +1218,12 @@ int main(int argc, char *argv[])
int ini_ignore = 0;
sapi_module_struct *sapi_module = &cli_sapi_module;
+ /*
+ * Do not move this initialization. It needs to happen before argv is used
+ * in any way.
+ */
+ argv = save_ps_args(argc, argv);
+
cli_sapi_module.additional_functions = additional_functions;
#if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
@@ -1300,6 +1312,7 @@ int main(int argc, char *argv[])
#ifndef PHP_CLI_WIN32_NO_CONSOLE
case 'S':
sapi_module = &cli_server_sapi_module;
+ cli_server_sapi_module.additional_functions = server_additional_functions;
break;
#endif
case 'h': /* help & quit */
@@ -1386,6 +1399,11 @@ out:
tsrm_shutdown();
#endif
+ /*
+ * Do not move this de-initialization. It needs to happen right before
+ * exiting.
+ */
+ cleanup_ps_args(argv);
exit(exit_status);
}
/* }}} */
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
new file mode 100644
index 0000000000..dec5613670
--- /dev/null
+++ b/sapi/cli/php_cli_process_title.c
@@ -0,0 +1,80 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2014 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Keyur Govande (kgovande@gmail.com) |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_cli_process_title.h"
+#include "ps_title.h"
+
+/* {{{ proto boolean cli_set_process_title(string arg)
+ Return a boolean to confirm if the process title was successfully changed or not */
+PHP_FUNCTION(cli_set_process_title)
+{
+ char *title = NULL;
+ int title_len;
+ int rc;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &title, &title_len) == FAILURE) {
+ return;
+ }
+
+ rc = set_ps_title(title);
+ if (rc == PS_TITLE_SUCCESS) {
+ RETURN_TRUE;
+ }
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "cli_set_process_title had an error: %s", ps_title_errno(rc));
+ RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto string cli_get_process_title()
+ Return a string with the current process title. NULL if error. */
+PHP_FUNCTION(cli_get_process_title)
+{
+ int length = 0;
+ const char* title = NULL;
+ int rc;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ rc = get_ps_title(&length, &title);
+ if (rc != PS_TITLE_SUCCESS) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "cli_get_process_title had an error: %s", ps_title_errno(rc));
+ RETURN_NULL();
+ }
+
+ RETURN_STRINGL(title, length, 1);
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
new file mode 100644
index 0000000000..bd44d99111
--- /dev/null
+++ b/sapi/cli/php_cli_process_title.h
@@ -0,0 +1,43 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2014 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Keyur Govande (kgovande@gmail.com) |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef PHP_PS_TITLE_HEADER
+#define PHP_PS_TITLE_HEADER
+
+ZEND_BEGIN_ARG_INFO(arginfo_cli_set_process_title, 0)
+ ZEND_ARG_INFO(0, title)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_cli_get_process_title, 0)
+ZEND_END_ARG_INFO()
+
+PHP_FUNCTION(cli_set_process_title);
+PHP_FUNCTION(cli_get_process_title);
+
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index e838d30558..98727da66f 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -105,6 +105,8 @@
#include "php_http_parser.h"
#include "php_cli_server.h"
+#include "php_cli_process_title.h"
+
#define OUTPUT_NOT_CHECKED -1
#define OUTPUT_IS_TTY 1
#define OUTPUT_NOT_TTY 0
@@ -131,6 +133,7 @@ typedef struct php_cli_server_request {
char *query_string;
size_t query_string_len;
HashTable headers;
+ HashTable headers_original_case;
char *content;
size_t content_len;
const char *ext;
@@ -252,7 +255,7 @@ static php_cli_server_http_response_status_code_pair status_map[] = {
static php_cli_server_http_response_status_code_pair template_map[] = {
{ 400, "<h1>%s</h1><p>Your browser sent a request that this server could not understand.</p>" },
- { 404, "<h1>%s</h1><p>The requested resource %s was not found on this server.</p>" },
+ { 404, "<h1>%s</h1><p>The requested resource <code class=\"url\">%s</code> was not found on this server.</p>" },
{ 500, "<h1>%s</h1><p>The server is temporarily unavailable.</p>" },
{ 501, "<h1>%s</h1><p>Request method not supported.</p>" }
};
@@ -266,12 +269,52 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "jpg", "image/jpeg" },
{ "jpeg", "image/jpeg" },
{ "jpe", "image/jpeg" },
+ { "pdf", "application/pdf" },
{ "png", "image/png" },
{ "svg", "image/svg+xml" },
{ "txt", "text/plain" },
{ "webm", "video/webm" },
{ "ogv", "video/ogg" },
{ "ogg", "audio/ogg" },
+ { "3gp", "video/3gpp" }, /* This is standard video format used for MMS in phones */
+ { "apk", "application/vnd.android.package-archive" },
+ { "avi", "video/x-msvideo" },
+ { "bmp", "image/x-ms-bmp" },
+ { "csv", "text/comma-separated-values" },
+ { "doc", "application/msword" },
+ { "docx", "application/msword" },
+ { "flac", "audio/flac" },
+ { "gz", "application/x-gzip" },
+ { "gzip", "application/x-gzip" },
+ { "ics", "text/calendar" },
+ { "kml", "application/vnd.google-earth.kml+xml" },
+ { "kmz", "application/vnd.google-earth.kmz" },
+ { "m4a", "audio/mp4" },
+ { "mp3", "audio/mpeg" },
+ { "mp4", "video/mp4" },
+ { "mpg", "video/mpeg" },
+ { "mpeg", "video/mpeg" },
+ { "mov", "video/quicktime" },
+ { "odp", "application/vnd.oasis.opendocument.presentation" },
+ { "ods", "application/vnd.oasis.opendocument.spreadsheet" },
+ { "odt", "application/vnd.oasis.opendocument.text" },
+ { "oga", "audio/ogg" },
+ { "pdf", "application/pdf" },
+ { "pptx", "application/vnd.ms-powerpoint" },
+ { "pps", "application/vnd.ms-powerpoint" },
+ { "qt", "video/quicktime" },
+ { "swf", "application/x-shockwave-flash" },
+ { "tar", "application/x-tar" },
+ { "text", "text/plain" },
+ { "tif", "image/tiff" },
+ { "wav", "audio/wav" },
+ { "wmv", "video/x-ms-wmv" },
+ { "xls", "application/vnd.ms-excel" },
+ { "xlsx", "application/vnd.ms-excel" },
+ { "zip", "application/x-zip-compressed" },
+ { "xml", "application/xml" },
+ { "xsl", "application/xml" },
+ { "xsd", "application/xml" },
{ NULL, NULL }
};
@@ -289,8 +332,10 @@ ZEND_DECLARE_MODULE_GLOBALS(cli_server);
* copied from ext/standard/info.c
*/
static const char php_cli_server_css[] = "<style>\n" \
- "body { background-color: #ffffff; color: #000000; }\n" \
- "h1 { font-family: sans-serif; font-size: 150%; background-color: #9999cc; font-weight: bold; color: #000000; margin-top: 0;}\n" \
+ "body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; }\n" \
+ "h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; }\n" \
+ "h1, p { padding-left: 10px; }\n" \
+ "code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;}\n" \
"</style>\n";
/* }}} */
@@ -430,6 +475,75 @@ static const char *get_mime_type(const char *ext, size_t ext_len) /* {{{ */
return NULL;
} /* }}} */
+PHP_FUNCTION(apache_request_headers) /* {{{ */
+{
+ php_cli_server_client *client;
+ HashTable *headers;
+ char *key;
+ uint key_len;
+ char **value_pointer;
+ HashPosition pos;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ client = SG(server_context);
+ headers = &client->request.headers_original_case;
+
+ array_init_size(return_value, zend_hash_num_elements(headers));
+
+ zend_hash_internal_pointer_reset_ex(headers, &pos);
+ while (zend_hash_get_current_data_ex(headers, (void **)&value_pointer, &pos) == SUCCESS) {
+ zend_hash_get_current_key_ex(headers, &key, &key_len, NULL, 0, &pos);
+ add_assoc_string_ex(return_value, key, key_len, *value_pointer, 1);
+ zend_hash_move_forward_ex(headers, &pos);
+ }
+}
+/* }}} */
+
+static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS_DC) /* {{{ */
+{
+ char *s, *p;
+ int len;
+ ALLOCA_FLAG(use_heap)
+
+ if (h->header_len > 0) {
+ p = strchr(h->header, ':');
+ len = p - h->header;
+ if (p && (len > 0)) {
+ while (len > 0 && (h->header[len-1] == ' ' || h->header[len-1] == '\t')) {
+ len--;
+ }
+ if (len) {
+ s = do_alloca(len + 1, use_heap);
+ memcpy(s, h->header, len);
+ s[len] = 0;
+ do {
+ p++;
+ } while (*p == ' ' || *p == '\t');
+ add_assoc_stringl_ex(return_value, s, len+1, p, h->header_len - (p - h->header), 1);
+ free_alloca(s, use_heap);
+ }
+ }
+ }
+}
+/* }}} */
+
+PHP_FUNCTION(apache_response_headers) /* {{{ */
+{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ if (!&SG(sapi_headers).headers) {
+ RETURN_FALSE;
+ }
+ array_init(return_value);
+ zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t)add_response_header, return_value TSRMLS_CC);
+}
+/* }}} */
+
/* {{{ cli_server module
*/
@@ -474,6 +588,18 @@ zend_module_entry cli_server_module_entry = {
};
/* }}} */
+ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
+ZEND_END_ARG_INFO()
+
+const zend_function_entry server_additional_functions[] = {
+ PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
+ PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
+ PHP_FE(apache_request_headers, arginfo_no_args)
+ PHP_FE(apache_response_headers, arginfo_no_args)
+ PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
+ {NULL, NULL, NULL}
+};
+
static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */
{
if (php_module_startup(sapi_module, &cli_server_module_entry, 1) == FAILURE) {
@@ -1289,6 +1415,7 @@ static int php_cli_server_request_ctor(php_cli_server_request *req) /* {{{ */
req->query_string = NULL;
req->query_string_len = 0;
zend_hash_init(&req->headers, 0, NULL, (void(*)(void*))char_ptr_dtor_p, 1);
+ zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1);
req->content = NULL;
req->content_len = 0;
req->ext = NULL;
@@ -1314,6 +1441,7 @@ static void php_cli_server_request_dtor(php_cli_server_request *req) /* {{{ */
pefree(req->query_string, 1);
}
zend_hash_destroy(&req->headers);
+ zend_hash_destroy(&req->headers_original_case);
if (req->content) {
pefree(req->content, 1);
}
@@ -1558,6 +1686,7 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
{
char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len);
zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL);
+ zend_hash_add(&client->request.headers_original_case, client->current_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL);
efree(header_name);
}
@@ -1983,40 +2112,38 @@ static int php_cli_server_request_shutdown(php_cli_server *server, php_cli_serve
static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) /* {{{ */
{
int decline = 0;
- if (!php_handle_special_queries(TSRMLS_C)) {
- zend_file_handle zfd;
- char *old_cwd;
-
- ALLOCA_FLAG(use_heap)
- old_cwd = do_alloca(MAXPATHLEN, use_heap);
- old_cwd[0] = '\0';
- php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1));
-
- zfd.type = ZEND_HANDLE_FILENAME;
- zfd.filename = server->router;
- zfd.handle.fp = NULL;
- zfd.free_filename = 0;
- zfd.opened_path = NULL;
-
- zend_try {
- zval *retval = NULL;
- if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) {
- if (retval) {
- decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval);
- zval_ptr_dtor(&retval);
- }
- } else {
- decline = 1;
+ zend_file_handle zfd;
+ char *old_cwd;
+
+ ALLOCA_FLAG(use_heap)
+ old_cwd = do_alloca(MAXPATHLEN, use_heap);
+ old_cwd[0] = '\0';
+ php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1));
+
+ zfd.type = ZEND_HANDLE_FILENAME;
+ zfd.filename = server->router;
+ zfd.handle.fp = NULL;
+ zfd.free_filename = 0;
+ zfd.opened_path = NULL;
+
+ zend_try {
+ zval *retval = NULL;
+ if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) {
+ if (retval) {
+ decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval);
+ zval_ptr_dtor(&retval);
}
- } zend_end_try();
-
- if (old_cwd[0] != '\0') {
- php_ignore_value(VCWD_CHDIR(old_cwd));
+ } else {
+ decline = 1;
}
+ } zend_end_try();
- free_alloca(old_cwd, use_heap);
+ if (old_cwd[0] != '\0') {
+ php_ignore_value(VCWD_CHDIR(old_cwd));
}
+ free_alloca(old_cwd, use_heap);
+
return decline;
}
/* }}} */
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index f8dff05d02..a8d7f46e7c 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -23,6 +23,7 @@
#include "SAPI.h"
+extern const zend_function_entry server_additional_functions[];
extern sapi_module_struct cli_server_sapi_module;
extern int do_cli_server(int argc, char **argv TSRMLS_DC);
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c
new file mode 100644
index 0000000000..53cd5fc9a0
--- /dev/null
+++ b/sapi/cli/ps_title.c
@@ -0,0 +1,437 @@
+/*
+ * PostgreSQL is released under the PostgreSQL License, a liberal Open Source
+ * license, similar to the BSD or MIT licenses.
+ * PostgreSQL Database Management System (formerly known as Postgres, then as
+ * Postgres95)
+ *
+ * Portions Copyright (c) 1996-2014, The PostgreSQL Global Development Group
+ *
+ * Portions Copyright (c) 1994, The Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without a written
+ * agreement is hereby granted, provided that the above copyright notice
+ * and this paragraph and the following two paragraphs appear in all copies.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
+ * EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+ * "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * The following code is adopted from the PostgreSQL's ps_status(.h/.c).
+ */
+
+#include "ps_title.h"
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef PHP_WIN32
+#include "config.w32.h"
+#include <windows.h>
+#include <process.h>
+#else
+#include "php_config.h"
+extern char** environ;
+#endif
+
+#ifdef HAVE_SYS_PSTAT_H
+#include <sys/pstat.h> /* for HP-UX */
+#endif
+#ifdef HAVE_PS_STRINGS
+#include <machine/vmparam.h> /* for old BSD */
+#include <sys/exec.h>
+#endif
+#if defined(DARWIN)
+#include <crt_externs.h>
+#endif
+
+/*
+ * Ways of updating ps display:
+ *
+ * PS_USE_SETPROCTITLE
+ * use the function setproctitle(const char *, ...)
+ * (newer BSD systems)
+ * PS_USE_PSTAT
+ * use the pstat(PSTAT_SETCMD, )
+ * (HPUX)
+ * PS_USE_PS_STRINGS
+ * assign PS_STRINGS->ps_argvstr = "string"
+ * (some BSD systems)
+ * PS_USE_CHANGE_ARGV
+ * assign argv[0] = "string"
+ * (some other BSD systems)
+ * PS_USE_CLOBBER_ARGV
+ * write over the argv and environment area
+ * (Linux and most SysV-like systems)
+ * PS_USE_WIN32
+ * push the string out as the name of a Windows event
+ * PS_USE_NONE
+ * don't update ps display
+ * (This is the default, as it is safest.)
+ */
+#if defined(HAVE_SETPROCTITLE)
+#define PS_USE_SETPROCTITLE
+#elif defined(HAVE_SYS_PSTAT_H) && defined(PSTAT_SETCMD)
+#define PS_USE_PSTAT
+#elif defined(HAVE_PS_STRINGS)
+#define PS_USE_PS_STRINGS
+#elif defined(BSD) && !defined(DARWIN)
+#define PS_USE_CHANGE_ARGV
+#elif defined(__linux__) || defined(_AIX) || defined(__sgi) || (defined(sun) && !defined(BSD)) || defined(ultrix) || defined(__osf__) || defined(DARWIN)
+#define PS_USE_CLOBBER_ARGV
+#elif defined(PHP_WIN32)
+#define PS_USE_WIN32
+#else
+#define PS_USE_NONE
+#endif
+
+/* Different systems want the buffer padded differently */
+#if defined(_AIX) || defined(__linux__) || defined(DARWIN)
+#define PS_PADDING '\0'
+#else
+#define PS_PADDING ' '
+#endif
+
+#ifdef PS_USE_WIN32
+static char windows_error_details[64];
+static char ps_buffer[MAX_PATH];
+static const size_t ps_buffer_size = MAX_PATH;
+#elif defined(PS_USE_CLOBBER_ARGV)
+static char *ps_buffer; /* will point to argv area */
+static size_t ps_buffer_size; /* space determined at run time */
+static char *empty_environ[] = {0}; /* empty environment */
+#else
+#define PS_BUFFER_SIZE 256
+static char ps_buffer[PS_BUFFER_SIZE];
+static const size_t ps_buffer_size = PS_BUFFER_SIZE;
+#endif
+
+static size_t ps_buffer_cur_len; /* actual string length in ps_buffer */
+
+/* save the original argv[] location here */
+static int save_argc;
+static char** save_argv;
+
+/*
+ * This holds the 'locally' allocated environ from the save_ps_args method.
+ * This is subsequently free'd at exit.
+ */
+static char** frozen_environ, **new_environ;
+
+/*
+ * Call this method early, before any code has used the original argv passed in
+ * from main().
+ * If needed, this code will make deep copies of argv and environ and return
+ * these to the caller for further use. The original argv is then 'clobbered'
+ * to store the process title.
+ */
+char** save_ps_args(int argc, char** argv)
+{
+ save_argc = argc;
+ save_argv = argv;
+
+#if defined(PS_USE_CLOBBER_ARGV)
+ /*
+ * If we're going to overwrite the argv area, count the available space.
+ * Also move the environment to make additional room.
+ */
+ {
+ char* end_of_area = NULL;
+ int non_contiguous_area = 0;
+ int i;
+
+ /*
+ * check for contiguous argv strings
+ */
+ for (i = 0; (non_contiguous_area == 0) && (i < argc); i++)
+ {
+ if (i != 0 && end_of_area + 1 != argv[i])
+ non_contiguous_area = 1;
+ end_of_area = argv[i] + strlen(argv[i]);
+ }
+
+ /*
+ * check for contiguous environ strings following argv
+ */
+ for (i = 0; (non_contiguous_area == 0) && (environ[i] != NULL); i++)
+ {
+ if (end_of_area + 1 != environ[i])
+ non_contiguous_area = 1;
+ end_of_area = environ[i] + strlen(environ[i]);
+ }
+
+ if (non_contiguous_area != 0)
+ goto clobber_error;
+
+ ps_buffer = argv[0];
+ ps_buffer_size = end_of_area - argv[0];
+
+ /*
+ * move the environment out of the way
+ */
+ new_environ = (char **) malloc((i + 1) * sizeof(char *));
+ frozen_environ = (char **) malloc((i + 1) * sizeof(char *));
+ if (!new_environ || !frozen_environ)
+ goto clobber_error;
+ for (i = 0; environ[i] != NULL; i++)
+ {
+ new_environ[i] = strdup(environ[i]);
+ if (!new_environ[i])
+ goto clobber_error;
+ }
+ new_environ[i] = NULL;
+ environ = new_environ;
+ memcpy((char *)frozen_environ, (char *)new_environ, sizeof(char *) * (i + 1));
+
+ }
+#endif /* PS_USE_CLOBBER_ARGV */
+
+#if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV)
+ /*
+ * If we're going to change the original argv[] then make a copy for
+ * argument parsing purposes.
+ *
+ * (NB: do NOT think to remove the copying of argv[]!
+ * On some platforms, getopt() keeps pointers into the argv array, and
+ * will get horribly confused when it is re-called to analyze a subprocess'
+ * argument string if the argv storage has been clobbered meanwhile.
+ * Other platforms have other dependencies on argv[].)
+ */
+ {
+ char** new_argv;
+ int i;
+
+ new_argv = (char **) malloc((argc + 1) * sizeof(char *));
+ if (!new_argv)
+ goto clobber_error;
+ for (i = 0; i < argc; i++)
+ {
+ new_argv[i] = strdup(argv[i]);
+ if (!new_argv[i])
+ goto clobber_error;
+ }
+ new_argv[argc] = NULL;
+
+#if defined(DARWIN)
+ /*
+ * Darwin (and perhaps other NeXT-derived platforms?) has a static
+ * copy of the argv pointer, which we may fix like so:
+ */
+ *_NSGetArgv() = new_argv;
+#endif
+
+ argv = new_argv;
+
+ }
+#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
+
+#if defined(PS_USE_CLOBBER_ARGV)
+ {
+ /* make extra argv slots point at end_of_area (a NUL) */
+ int i;
+ for (i = 1; i < save_argc; i++)
+ save_argv[i] = ps_buffer + ps_buffer_size;
+ }
+#endif /* PS_USE_CLOBBER_ARGV */
+
+#ifdef PS_USE_CHANGE_ARGV
+ save_argv[0] = ps_buffer; /* ps_buffer here is a static const array of size PS_BUFFER_SIZE */
+ save_argv[1] = NULL;
+#endif /* PS_USE_CHANGE_ARGV */
+
+ return argv;
+
+#if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV)
+clobber_error:
+ /* probably can't happen?!
+ * if we ever get here, argv still points to originally passed
+ * in argument
+ */
+ save_argv = NULL;
+ save_argc = 0;
+ ps_buffer = NULL;
+ ps_buffer_size = 0;
+ return argv;
+#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
+}
+
+/*
+ * Returns PS_TITLE_SUCCESS if the OS supports this functionality
+ * and the init function was called.
+ * Otherwise returns NOT_AVAILABLE or NOT_INITIALIZED
+ */
+int is_ps_title_available()
+{
+#ifdef PS_USE_NONE
+ return PS_TITLE_NOT_AVAILABLE; /* disabled functionality */
+#endif
+
+ if (!save_argv)
+ return PS_TITLE_NOT_INITIALIZED;
+
+#ifdef PS_USE_CLOBBER_ARGV
+ if (!ps_buffer)
+ return PS_TITLE_BUFFER_NOT_AVAILABLE;
+#endif /* PS_USE_CLOBBER_ARGV */
+
+ return PS_TITLE_SUCCESS;
+}
+
+/*
+ * Convert error codes into error strings
+ */
+const char* ps_title_errno(int rc)
+{
+ switch(rc)
+ {
+ case PS_TITLE_SUCCESS:
+ return "Success";
+
+ case PS_TITLE_NOT_AVAILABLE:
+ return "Not available on this OS";
+
+ case PS_TITLE_NOT_INITIALIZED:
+ return "Not initialized correctly";
+
+ case PS_TITLE_BUFFER_NOT_AVAILABLE:
+ return "Buffer not contiguous";
+
+#ifdef PS_USE_WIN32
+ case PS_TITLE_WINDOWS_ERROR:
+ sprintf(windows_error_details, "Windows error code: %d", GetLastError());
+ return windows_error_details;
+#endif
+ }
+
+ return "Unknown error code";
+}
+
+/*
+ * Set a new process title.
+ * Returns the appropriate error code if if there's an error
+ * (like the functionality is compile time disabled, or the
+ * save_ps_args() was not called.
+ * Else returns 0 on success.
+ */
+int set_ps_title(const char* title)
+{
+ int rc = is_ps_title_available();
+ if (rc != PS_TITLE_SUCCESS)
+ return rc;
+
+ strncpy(ps_buffer, title, ps_buffer_size);
+ ps_buffer[ps_buffer_size - 1] = '\0';
+ ps_buffer_cur_len = strlen(ps_buffer);
+
+#ifdef PS_USE_SETPROCTITLE
+ setproctitle("%s", ps_buffer);
+#endif
+
+#ifdef PS_USE_PSTAT
+ {
+ union pstun pst;
+
+ pst.pst_command = ps_buffer;
+ pstat(PSTAT_SETCMD, pst, ps_buffer_cur_len, 0, 0);
+ }
+#endif /* PS_USE_PSTAT */
+
+#ifdef PS_USE_PS_STRINGS
+ PS_STRINGS->ps_nargvstr = 1;
+ PS_STRINGS->ps_argvstr = ps_buffer;
+#endif /* PS_USE_PS_STRINGS */
+
+#ifdef PS_USE_CLOBBER_ARGV
+ /* pad unused memory */
+ if (ps_buffer_cur_len < ps_buffer_size)
+ {
+ memset(ps_buffer + ps_buffer_cur_len, PS_PADDING,
+ ps_buffer_size - ps_buffer_cur_len);
+ }
+#endif /* PS_USE_CLOBBER_ARGV */
+
+#ifdef PS_USE_WIN32
+ {
+ if (!SetConsoleTitle(ps_buffer))
+ return PS_TITLE_WINDOWS_ERROR;
+ }
+#endif /* PS_USE_WIN32 */
+
+ return PS_TITLE_SUCCESS;
+}
+
+/*
+ * Returns the current ps_buffer value into string. On some platforms
+ * the string will not be null-terminated, so return the effective
+ * length into *displen.
+ * The return code indicates the error.
+ */
+int get_ps_title(int *displen, const char** string)
+{
+ int rc = is_ps_title_available();
+ if (rc != PS_TITLE_SUCCESS)
+ return rc;
+
+#ifdef PS_USE_WIN32
+ if (!(ps_buffer_cur_len = GetConsoleTitle(ps_buffer, ps_buffer_size)))
+ return PS_TITLE_WINDOWS_ERROR;
+#endif
+ *displen = (int)ps_buffer_cur_len;
+ *string = ps_buffer;
+ return PS_TITLE_SUCCESS;
+}
+
+/*
+ * Clean up the allocated argv and environ if applicable. Only call
+ * this right before exiting.
+ * This isn't needed per-se because the OS will clean-up anyway, but
+ * having and calling this will ensure Valgrind doesn't output 'false
+ * positives'.
+ */
+void cleanup_ps_args(char **argv)
+{
+#ifndef PS_USE_NONE
+ if (save_argv)
+ {
+ save_argv = NULL;
+ save_argc = 0;
+
+#ifdef PS_USE_CLOBBER_ARGV
+ {
+ int i;
+ for (i = 0; frozen_environ[i] != NULL; i++)
+ free(frozen_environ[i]);
+ free(frozen_environ);
+ free(new_environ);
+ /* leave a sane environment behind since some atexit() handlers
+ call getenv(). */
+ environ = empty_environ;
+ }
+#endif /* PS_USE_CLOBBER_ARGV */
+
+#if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV)
+ {
+ int i;
+ for (i=0; argv[i] != NULL; i++)
+ free(argv[i]);
+ free(argv);
+ }
+#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
+ }
+#endif /* PS_USE_NONE */
+
+ return;
+}
diff --git a/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
new file mode 100644
index 0000000000..09650fed08
--- /dev/null
+++ b/sapi/cli/ps_title.h
@@ -0,0 +1,42 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2014 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Keyur Govande <kgovande@gmail.com> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#ifndef PS_TITLE_HEADER
+#define PS_TITLE_HEADER
+
+#define PS_TITLE_SUCCESS 0
+#define PS_TITLE_NOT_AVAILABLE 1
+#define PS_TITLE_NOT_INITIALIZED 2
+#define PS_TITLE_BUFFER_NOT_AVAILABLE 3
+#define PS_TITLE_WINDOWS_ERROR 4
+
+extern char** save_ps_args(int argc, char** argv);
+
+extern int set_ps_title(const char* new_str);
+
+extern int get_ps_title(int* displen, const char** string);
+
+extern const char* ps_title_errno(int rc);
+
+extern int is_ps_title_available();
+
+extern void cleanup_ps_args(char **argv);
+
+#endif // PS_TITLE_HEADER
diff --git a/sapi/cli/tests/bug64544.phpt b/sapi/cli/tests/bug64544.phpt
new file mode 100644
index 0000000000..cc49545c16
--- /dev/null
+++ b/sapi/cli/tests/bug64544.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #64544 (Valgrind warnings after using putenv)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == "WIN") {
+ die("skip non windows test");
+}
+?>
+--FILE--
+<?php
+
+putenv("HOME=/tmp");
+var_dump(getenv("HOME"));
+
+putenv("FOO=BAR");
+var_dump(getenv("FOO"));
+?>
+--EXPECTF--
+string(4) "/tmp"
+string(3) "BAR"
diff --git a/sapi/cli/tests/cli_process_title_unix.phpt b/sapi/cli/tests/cli_process_title_unix.phpt
new file mode 100644
index 0000000000..c2632704c5
--- /dev/null
+++ b/sapi/cli/tests/cli_process_title_unix.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Check cli_process_title support on Unix
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
+ die("skip");
+?>
+--FILE--
+<?php
+echo "*** Testing setting the process title ***\n";
+
+$set_title = $original_title = uniqid("title", true);
+$pid = getmypid();
+
+if (cli_set_process_title($original_title) === true)
+ echo "Successfully set title\n";
+
+$ps_output = shell_exec("ps -p $pid -o command | tail -n 1");
+
+if ($ps_output === null)
+{
+ echo "ps failed\n";
+ die();
+}
+
+$loaded_title = trim($ps_output);
+if (strpos(strtoupper(substr(PHP_OS, 0, 13)), "BSD") !== false)
+{
+ // Fix up title for BSD
+ $set_title = "php: $original_title (php)";
+}
+
+if ($loaded_title == $set_title)
+ echo "Successfully verified title using ps\n";
+else
+ echo "Actually loaded from ps: $loaded_title\n";
+
+$read_title = cli_get_process_title();
+if ($read_title == $original_title)
+ echo "Successfully verified title using get\n";
+else
+ echo "Actually loaded from get: $read_title\n";
+
+?>
+--EXPECTF--
+*** Testing setting the process title ***
+Successfully set title
+Successfully verified title using ps
+Successfully verified title using get
diff --git a/sapi/cli/tests/cli_process_title_windows.phpt b/sapi/cli/tests/cli_process_title_windows.phpt
new file mode 100644
index 0000000000..472f9c10fe
--- /dev/null
+++ b/sapi/cli/tests/cli_process_title_windows.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Check cli_process_title support in Windows
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
+ die("skip");
+?>
+--FILE--
+<?php
+
+// On Windows 8 and Server 2012, this test does not work the same way. When the PowerShell
+// command "get-process" is executed using shell_exec, it overwrites the ConsoleTitle with
+// "Windows PowerShell" and this title ONLY clears away when the php.exe process exits
+// i.e. the test finishes.
+// On older versions like Windows 7 though, running the command appends
+// "Windows PowerShell" to the ConsoleTitle temporarily and the title reverts
+// back to the original once shell_exec is done.
+// Hence on Windows 8, we don't verify that the title is actually set by
+// cli_set_process_title(). We're only making the API calls to ensure there are
+// no warnings/errors.
+
+$is_windows8 = false;
+$ps_output = shell_exec("PowerShell -NoProfile \"(Get-Host).UI.RawUI.WindowTitle\"");
+if ($ps_output === null)
+{
+ echo "Get-Host failed\n";
+ die();
+}
+
+$ps_output = trim($ps_output);
+$end_title_windows8 = ": Windows PowerShell";
+if (($ps_output == "Windows PowerShell") || (strlen($ps_output) > strlen($end_title_windows8) && substr($ps_output,-strlen($end_title_windows8)) === $end_title_windows8))
+ $is_windows8 = true;
+
+echo "*** Testing setting the process title ***\n";
+
+$original_title = uniqid("title", true);
+$pid = getmypid();
+
+if (cli_set_process_title($original_title) === true)
+ echo "Successfully set title\n";
+
+if ($is_windows8)
+{
+ $loaded_title = $original_title;
+}
+else
+{
+ $loaded_title = shell_exec("PowerShell -NoProfile \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\"");
+
+ if ($loaded_title === null)
+ {
+ echo "Reading title using get-process failed\n";
+ die();
+ }
+
+ // Kind of convoluted. So when the test is run on Windows 7 or older, the console where
+ // the run-tests.php is executed forks a php.exe, which forks a cmd.exe, which then forks
+ // a final php.exe to run the actual test. But the console title is set for the original console.
+ // I couldn't figure out a good way to navigate this, so we're "grep'ing" all possible
+ // console windows for our very unique title. It should occur exactly once in the grep
+ // output.
+ if (substr_count($loaded_title, $original_title, 0) == 1)
+ $loaded_title = $original_title;
+}
+
+if ($loaded_title == $original_title)
+ echo "Successfully verified title using get-process\n";
+else
+ echo "Actually loaded from get-process: $loaded_title\n";
+
+$read_title = cli_get_process_title();
+if (substr_count($read_title, $original_title, 0) == 1)
+ echo "Successfully verified title using get\n";
+else
+ echo "Actually loaded from get: $read_title\n";
+
+?>
+--EXPECTF--
+*** Testing setting the process title ***
+Successfully set title
+Successfully verified title using get-process
+Successfully verified title using get \ No newline at end of file
diff --git a/sapi/cli/tests/php_cli_server_011.phpt b/sapi/cli/tests/php_cli_server_011.phpt
deleted file mode 100644
index a957a8ed4c..0000000000
--- a/sapi/cli/tests/php_cli_server_011.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Bug #60180 ($_SERVER["PHP_SELF"] incorrect)
---SKIPIF--
-<?php
-include "skipif.inc";
-?>
---FILE--
-<?php
-include "php_cli_server.inc";
-php_cli_server_start('sytanx error;', TRUE);
-
-list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
-$port = intval($port)?:80;
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
- die("connect failed");
-}
-
-$logo_id = php_logo_guid();
-
-if(fwrite($fp, <<<HEADER
-GET /?={$logo_id} HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
- while (!feof($fp)) {
- if (("Content-Type: image/gif") == trim(fgets($fp))) {
- echo "okey";
- break;
- }
- }
-}
-
-fclose($fp);
-
-?>
---EXPECTF--
-okey
diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt
index 570798a880..0e3f4ff74f 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -88,7 +88,7 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
-</head><body><h1>Not Found</h1><p>The requested resource / was not found on this server.</p></body></html>
+</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
Connection: close
@@ -96,7 +96,7 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
-</head><body><h1>Not Found</h1><p>The requested resource /main/style.css was not found on this server.</p></body></html>
+</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/style.css</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
Connection: close
@@ -104,5 +104,5 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
-</head><body><h1>Not Found</h1><p>The requested resource /main/foo/bar was not found on this server.</p></body></html>
+</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/foo/bar</code> was not found on this server.</p></body></html>
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index f8a9905613..e8bb5fa8a2 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -77,4 +77,4 @@ Content-Type: %s
Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style>
-</head><body><h1>Not Found</h1><p>The requested resource /main/no-exists.php was not found on this server.</p></body></html>
+</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/no-exists.php</code> was not found on this server.</p></body></html>
diff --git a/sapi/cli/tests/php_cli_server_019.phpt b/sapi/cli/tests/php_cli_server_019.phpt
new file mode 100644
index 0000000000..2b983e5c0a
--- /dev/null
+++ b/sapi/cli/tests/php_cli_server_019.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Implement Req #65917 (getallheaders() is not supported by the built-in web server)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start(<<<'PHP'
+header('Bar-Foo: Foo');
+var_dump(getallheaders());
+var_dump(apache_request_headers());
+var_dump(apache_response_headers());
+PHP
+);
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+ die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+GET / HTTP/1.1
+Host: {$host}
+Foo-Bar: Bar
+
+
+HEADER
+)) {
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
+}
+
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Connection: close
+X-Powered-By: %s
+Bar-Foo: Foo
+Content-type: text/html
+
+array(2) {
+ ["Host"]=>
+ string(9) "localhost"
+ ["Foo-Bar"]=>
+ string(3) "Bar"
+}
+array(2) {
+ ["Host"]=>
+ string(9) "localhost"
+ ["Foo-Bar"]=>
+ string(3) "Bar"
+}
+array(3) {
+ ["X-Powered-By"]=>
+ string(%d) "P%s"
+ ["Bar-Foo"]=>
+ string(3) "Foo"
+ ["Content-type"]=>
+ string(9) "text/html"
+}
diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4
index 3a61b458f0..5ffb9b39bd 100644
--- a/sapi/embed/config.m4
+++ b/sapi/embed/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_ENABLE(embed,,
-[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
+[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
TYPE is either 'shared' or 'static'. [TYPE=shared]], no, no)
AC_MSG_CHECKING([for embedded SAPI library support])
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index 579f7c2846..bd6d64930b 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_ENABLE(fpm,,
-[ --enable-fpm Enable building of the fpm SAPI executable], no, no)
+[ --enable-fpm Enable building of the fpm SAPI executable], no, no)
dnl configure checks {{{
AC_DEFUN([AC_FPM_STDLIBS],
@@ -557,11 +557,11 @@ if test "$PHP_FPM" != "no"; then
AC_FPM_SELECT
PHP_ARG_WITH(fpm-user,,
- [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no)
+ [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no)
PHP_ARG_WITH(fpm-group,,
- [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this
- should usually be set to match the fpm username (default: nobody)], nobody, no)
+ [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this
+ should usually be set to match the fpm username (default: nobody)], nobody, no)
PHP_ARG_WITH(fpm-systemd,,
[ --with-fpm-systemd Activate systemd integration], no, no)
@@ -607,16 +607,12 @@ if test "$PHP_FPM" != "no"; then
AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name])
AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
- AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name])
- AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
-
PHP_ADD_BUILD_DIR(sapi/fpm/fpm)
PHP_ADD_BUILD_DIR(sapi/fpm/fpm/events)
PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html)
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag])
SAPI_FPM_PATH=sapi/fpm/php-fpm
-
if test "$fpm_trace_type" && test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"; then
PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"
diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
index 80745a9c7e..d77b6f8ca7 100644
--- a/sapi/fpm/fpm/fastcgi.c
+++ b/sapi/fpm/fpm/fastcgi.c
@@ -611,7 +611,7 @@ static int fcgi_read_request(fcgi_request *req)
}
zend_hash_internal_pointer_reset_ex(req->env, &pos);
- while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
+ while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTENT) {
int zlen;
zend_hash_move_forward_ex(req->env, &pos);
if (key_type != HASH_KEY_IS_STRING) {
diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
index cce5712b8c..121c016a7b 100644
--- a/sapi/fpm/fpm/fpm_sockets.h
+++ b/sapi/fpm/fpm/fpm_sockets.h
@@ -19,7 +19,7 @@
#if (__FreeBSD__) || (__OpenBSD__)
#define FPM_BACKLOG_DEFAULT -1
#else
-#define FPM_BACKLOG_DEFAULT 128
+#define FPM_BACKLOG_DEFAULT 65535
#endif
enum fpm_address_domain fpm_sockets_domain_from_address(char *addr);
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index 9205d42239..c5f4abc59c 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -159,8 +159,8 @@ group = @php_fpm_group@
listen = 127.0.0.1:9000
; Set listen(2) backlog.
-; Default Value: 128 (-1 on FreeBSD and OpenBSD)
-;listen.backlog = 128
+; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
+;listen.backlog = 65535
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
index 7c7dcf0c21..6014bab09f 100644
--- a/sapi/isapi/config.m4
+++ b/sapi/isapi/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_WITH(isapi, for Zeus ISAPI support,
-[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no)
+[ --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
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index 84e870d628..52c39f1b6c 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -75,8 +75,7 @@ static int lsapi_mode = 1;
static char *php_self = "";
static char *script_filename = "";
static int source_highlight = 0;
-static char * argv0 = NULL;
-static int engine = 1;
+
#ifdef ZTS
zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
@@ -91,65 +90,40 @@ zend_module_entry litespeed_module_entry;
*/
static int php_lsapi_startup(sapi_module_struct *sapi_module)
{
- if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
- return FAILURE;
- }
- argv0 = sapi_module->executable_location;
- return SUCCESS;
+ if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+ return FAILURE;
+ }
+ return SUCCESS;
}
/* }}} */
-/* {{{ sapi_lsapi_ini_defaults */
-
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
-#define INI_DEFAULT(name,value)\
- ZVAL_STRING(tmp, value, 0);\
- zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry))
-
-static void sapi_lsapi_ini_defaults(HashTable *configuration_hash)
-{
- zval *tmp, *entry;
-
-#if PHP_MAJOR_VERSION > 4
-/*
- MAKE_STD_ZVAL(tmp);
-
- INI_DEFAULT("register_long_arrays", "0");
-
- FREE_ZVAL(tmp);
-*/
-#endif
-
-}
-/* }}} */
/* {{{ sapi_lsapi_ub_write
*/
static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
- int ret;
- int remain;
- if ( lsapi_mode ) {
- ret = LSAPI_Write( str, str_length );
- if ( ret < str_length ) {
- php_handle_aborted_connection();
- return str_length - ret;
- }
- } else {
- remain = str_length;
- while( remain > 0 ) {
- ret = write( 1, str, remain );
- if ( ret <= 0 ) {
- php_handle_aborted_connection();
- return str_length - remain;
- }
- str += ret;
- remain -= ret;
- }
- }
- return str_length;
+ int ret;
+ int remain;
+ if ( lsapi_mode ) {
+ ret = LSAPI_Write( str, str_length );
+ if ( ret < str_length ) {
+ php_handle_aborted_connection();
+ return str_length - ret;
+ }
+ } else {
+ remain = str_length;
+ while( remain > 0 ) {
+ ret = write( 1, str, remain );
+ if ( ret <= 0 ) {
+ php_handle_aborted_connection();
+ return str_length - remain;
+ }
+ str += ret;
+ remain -= ret;
+ }
+ }
+ return str_length;
}
/* }}} */
@@ -158,11 +132,11 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC)
*/
static void sapi_lsapi_flush( void * server_context )
{
- if ( lsapi_mode ) {
- if ( LSAPI_Flush() == -1) {
- php_handle_aborted_connection();
- }
- }
+ if ( lsapi_mode ) {
+ if ( LSAPI_Flush() == -1) {
+ php_handle_aborted_connection();
+ }
+ }
}
/* }}} */
@@ -171,12 +145,8 @@ static void sapi_lsapi_flush( void * server_context )
*/
static int sapi_lsapi_deactivate(TSRMLS_D)
{
- if ( SG(request_info).path_translated )
- {
- efree( SG(request_info).path_translated );
- }
-
- return SUCCESS;
+ LSAPI_Finish();
+ return SUCCESS;
}
/* }}} */
@@ -187,99 +157,46 @@ static int sapi_lsapi_deactivate(TSRMLS_D)
*/
static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC )
{
- if ( lsapi_mode ) {
- return LSAPI_GetEnv( name );
- } else {
- return getenv( name );
- }
+ if ( lsapi_mode ) {
+ return LSAPI_GetEnv( name );
+ } else {
+ return getenv( name );
+ }
}
/* }}} */
-/*
-static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen,
- void * arg )
-{
- php_register_variable_safe((char *)pKey, (char *)pValue, valLen, (zval *)arg TSRMLS_CC);
- return 1;
-}
-*/
static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen,
- void * arg )
+ void * arg )
{
- zval * gpc_element, **gpc_element_p;
- HashTable * symtable1 = Z_ARRVAL_P((zval * )arg);
- register char * pKey1 = (char *)pKey;
-
- MAKE_STD_ZVAL(gpc_element);
- Z_STRLEN_P( gpc_element ) = valLen;
- Z_STRVAL_P( gpc_element ) = estrndup(pValue, valLen);
- Z_TYPE_P( gpc_element ) = IS_STRING;
-#if PHP_MAJOR_VERSION > 4
- zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p );
-#else
- zend_hash_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p );
-#endif
- return 1;
+ php_register_variable_safe((char *)pKey, (char *)pValue, valLen, (zval *)arg TSRMLS_CC);
+ return 1;
}
-#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5)
-static int add_variable_magic_quote( const char * pKey, int keyLen, const char * pValue, int valLen,
- void * arg )
-{
- zval * gpc_element, **gpc_element_p;
- HashTable * symtable1 = Z_ARRVAL_P((zval * )arg);
- register char * pKey1 = (char *)pKey;
-
- MAKE_STD_ZVAL(gpc_element);
- Z_STRLEN_P( gpc_element ) = valLen;
- Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRLEN_P( gpc_element ), 0 );
- Z_TYPE_P( gpc_element ) = IS_STRING;
-#if PHP_MAJOR_VERSION > 4
- zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p );
-#else
- zend_hash_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p );
-#endif
- return 1;
-}
-
-#endif
/* {{{ sapi_lsapi_register_variables
*/
static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC)
{
- char * php_self = "";
- if ( lsapi_mode ) {
- if ( (SG(request_info).request_uri ) )
- php_self = (SG(request_info).request_uri );
-#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5)
- if (!PG(magic_quotes_gpc)) {
-#endif
- LSAPI_ForeachHeader( add_variable, track_vars_array );
- LSAPI_ForeachEnv( add_variable, track_vars_array );
- add_variable("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array );
-#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5)
- } else {
- LSAPI_ForeachHeader( add_variable_magic_quote, track_vars_array );
- LSAPI_ForeachEnv( add_variable_magic_quote, track_vars_array );
- add_variable_magic_quote("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array );
- }
-#endif
- php_import_environment_variables(track_vars_array TSRMLS_CC);
- } else {
- php_import_environment_variables(track_vars_array TSRMLS_CC);
+ if ( lsapi_mode ) {
+ LSAPI_ForeachHeader( add_variable, track_vars_array );
+ LSAPI_ForeachEnv( add_variable, track_vars_array );
+ php_import_environment_variables(track_vars_array TSRMLS_CC);
- php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC);
- php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC);
- php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC);
- php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC);
- php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC);
+ php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRMLS_CC);
+ } else {
+ php_import_environment_variables(track_vars_array TSRMLS_CC);
- }
+ php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC);
+ php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC);
+ php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC);
+ php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC);
+ php_register_variable("DOCUMENT_ROOT", "", track_vars_array TSRMLS_CC);
+
+ }
}
/* }}} */
@@ -288,11 +205,11 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC)
*/
static int sapi_lsapi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
{
- if ( lsapi_mode ) {
- return LSAPI_ReadReqBody( buffer, count_bytes );
- } else {
- return 0;
- }
+ if ( lsapi_mode ) {
+ return LSAPI_ReadReqBody( buffer, count_bytes );
+ } else {
+ return 0;
+ }
}
/* }}} */
@@ -303,11 +220,11 @@ static int sapi_lsapi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
*/
static char *sapi_lsapi_read_cookies(TSRMLS_D)
{
- if ( lsapi_mode ) {
- return LSAPI_GetHeader( H_COOKIE );
- } else {
- return NULL;
- }
+ if ( lsapi_mode ) {
+ return LSAPI_GetHeader( H_COOKIE );
+ } else {
+ return NULL;
+ }
}
/* }}} */
@@ -316,33 +233,33 @@ static char *sapi_lsapi_read_cookies(TSRMLS_D)
*/
static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
- sapi_header_struct *h;
- zend_llist_position pos;
- if ( lsapi_mode ) {
- LSAPI_SetRespStatus( SG(sapi_headers).http_response_code );
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
- if ( h->header_len > 0 ) {
- LSAPI_AppendRespHeader(h->header, h->header_len);
- }
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
- if (SG(sapi_headers).send_default_content_type) {
- char *hd;
- int len;
- char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
-
- hd = sapi_get_default_content_type(TSRMLS_C);
- len = snprintf( headerBuf, SAPI_LSAPI_MAX_HEADER_LENGTH - 1,
- "Content-type: %s", hd );
- efree(hd);
-
- LSAPI_AppendRespHeader( headerBuf, len );
- }
- }
- LSAPI_FinalizeRespHeaders();
- return SAPI_HEADER_SENT_SUCCESSFULLY;
+ sapi_header_struct *h;
+ zend_llist_position pos;
+ if ( lsapi_mode ) {
+ LSAPI_SetRespStatus( SG(sapi_headers).http_response_code );
+
+ h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
+ while (h) {
+ if ( h->header_len > 0 ) {
+ LSAPI_AppendRespHeader(h->header, h->header_len);
+ }
+ h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
+ }
+ if (SG(sapi_headers).send_default_content_type) {
+ char *hd;
+ int len;
+ char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
+
+ hd = sapi_get_default_content_type(TSRMLS_C);
+ len = snprintf( headerBuf, SAPI_LSAPI_MAX_HEADER_LENGTH - 1,
+ "Content-type: %s", hd );
+ efree(hd);
+
+ LSAPI_AppendRespHeader( headerBuf, len );
+ }
+ }
+ LSAPI_FinalizeRespHeaders();
+ return SAPI_HEADER_SENT_SUCCESSFULLY;
}
@@ -353,8 +270,8 @@ static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
*/
static void sapi_lsapi_log_message(char *message TSRMLS_DC)
{
- int len = strlen( message );
- LSAPI_Write_Stderr( message, len);
+ int len = strlen( message );
+ LSAPI_Write_Stderr( message, len);
}
/* }}} */
@@ -363,247 +280,158 @@ static void sapi_lsapi_log_message(char *message TSRMLS_DC)
*/
static sapi_module_struct lsapi_sapi_module =
{
- "litespeed",
- "LiteSpeed V5.5",
+ "litespeed",
+ "LiteSpeed",
- php_lsapi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
+ php_lsapi_startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- sapi_lsapi_deactivate, /* deactivate */
+ NULL, /* activate */
+ sapi_lsapi_deactivate, /* deactivate */
- sapi_lsapi_ub_write, /* unbuffered write */
- sapi_lsapi_flush, /* flush */
- NULL, /* get uid */
- sapi_lsapi_getenv, /* getenv */
+ sapi_lsapi_ub_write, /* unbuffered write */
+ sapi_lsapi_flush, /* flush */
+ NULL, /* get uid */
+ sapi_lsapi_getenv, /* getenv */
- php_error, /* error handler */
+ php_error, /* error handler */
- NULL, /* header handler */
- sapi_lsapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
+ NULL, /* header handler */
+ sapi_lsapi_send_headers, /* send headers handler */
+ NULL, /* send header handler */
- sapi_lsapi_read_post, /* read POST data */
- sapi_lsapi_read_cookies, /* read Cookies */
+ sapi_lsapi_read_post, /* read POST data */
+ sapi_lsapi_read_cookies, /* read Cookies */
- sapi_lsapi_register_variables, /* register server variables */
- sapi_lsapi_log_message, /* Log message */
+ sapi_lsapi_register_variables, /* register server variables */
+ sapi_lsapi_log_message, /* Log message */
- NULL, /* php.ini path override */
- NULL, /* block interruptions */
- NULL, /* unblock interruptions */
- NULL, /* default post reader */
- NULL, /* treat data */
- NULL, /* executable location */
+ NULL, /* php.ini path override */
+ NULL, /* block interruptions */
+ NULL, /* unblock interruptions */
+ NULL, /* default post reader */
+ NULL, /* treat data */
+ NULL, /* executable location */
- 0, /* php.ini ignore */
+ 0, /* php.ini ignore */
- STANDARD_SAPI_MODULE_PROPERTIES
+ STANDARD_SAPI_MODULE_PROPERTIES
};
/* }}} */
static int init_request_info( TSRMLS_D )
{
- char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE );
- char * pAuth;
-
- SG(request_info).content_type = pContentType ? pContentType : "";
- SG(request_info).request_method = LSAPI_GetRequestMethod();
- SG(request_info).query_string = LSAPI_GetQueryString();
- SG(request_info).request_uri = LSAPI_GetScriptName();
- SG(request_info).content_length = LSAPI_GetReqBodyLen();
- SG(request_info).path_translated = estrdup( LSAPI_GetScriptFileName());
-
- /* It is not reset by zend engine, set it to 0. */
- SG(sapi_headers).http_response_code = 0;
-
- pAuth = LSAPI_GetHeader( H_AUTHORIZATION );
- php_handle_auth_data(pAuth TSRMLS_CC);
-}
-
-static char s_cur_chdir[4096] = "";
+ char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE );
+ char * pAuth;
+
+ SG(request_info).content_type = pContentType ? pContentType : "";
+ SG(request_info).request_method = LSAPI_GetRequestMethod();
+ SG(request_info).query_string = LSAPI_GetQueryString();
+ SG(request_info).request_uri = LSAPI_GetScriptName();
+ SG(request_info).content_length = LSAPI_GetReqBodyLen();
+ SG(request_info).path_translated = LSAPI_GetScriptFileName();
-static int lsapi_chdir_primary_script( zend_file_handle * file_handle )
-{
-#if PHP_MAJOR_VERSION > 4
- char * p;
- char ch;
-
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- getcwd( s_cur_chdir, sizeof( s_cur_chdir ) );
-
- p = strrchr( file_handle->filename, '/' );
- if ( *p )
- {
- *p = 0;
- if ( strcmp( file_handle->filename, s_cur_chdir ) != 0 ) {
- chdir( file_handle->filename );
- }
- *p++ = '/';
- ch = *p;
- *p = 0;
- if ( !CWDG(cwd).cwd ||
- ( strcmp( file_handle->filename, CWDG(cwd).cwd ) != 0 ) ) {
- CWDG(cwd).cwd_length = p - file_handle->filename;
- CWDG(cwd).cwd = (char *) realloc(CWDG(cwd).cwd, CWDG(cwd).cwd_length+1);
- memmove( CWDG(cwd).cwd, file_handle->filename, CWDG(cwd).cwd_length+1 );
- }
- *p = ch;
- }
- /* virtual_file_ex(&CWDG(cwd), file_handle->filename, NULL, CWD_REALPATH); */
-#else
- VCWD_CHDIR_FILE( file_handle->filename );
-#endif
- return 0;
-}
-
-static int lsapi_fopen_primary_script( zend_file_handle * file_handle )
-{
- FILE * fp;
- char * p;
- fp = fopen( SG(request_info).path_translated, "rb" );
- if ( !fp )
- {
- return -1;
- }
- file_handle->type = ZEND_HANDLE_FP;
- file_handle->handle.fp = fp;
- file_handle->filename = SG(request_info).path_translated;
- file_handle->free_filename = 0;
- file_handle->opened_path = NULL;
-
- lsapi_chdir_primary_script( file_handle );
-
- return 0;
+ /* It is not reset by zend engine, set it to 0. */
+ SG(sapi_headers).http_response_code = 0;
+
+ pAuth = LSAPI_GetHeader( H_AUTHORIZATION );
+ php_handle_auth_data(pAuth TSRMLS_CC);
}
-static int lsapi_execute_script( zend_file_handle * file_handle TSRMLS_DC)
+static int lsapi_module_main(int show_source TSRMLS_DC)
{
- char *p;
- int len;
- file_handle->type = ZEND_HANDLE_FILENAME;
- file_handle->handle.fd = 0;
- file_handle->filename = SG(request_info).path_translated;
- file_handle->free_filename = 0;
- file_handle->opened_path = NULL;
-
- p = argv0;
- *p++ = ':';
- len = strlen( SG(request_info).path_translated );
- if ( len > 45 )
- len = len - 45;
- else
- len = 0;
- memccpy( p, SG(request_info).path_translated + len, 0, 46 );
-
- php_execute_script(file_handle TSRMLS_CC);
- return 0;
+ zend_file_handle file_handle = {0};
-}
+ if (php_request_startup(TSRMLS_C) == FAILURE ) {
+ return -1;
+ }
+ if (show_source) {
+ zend_syntax_highlighter_ini syntax_highlighter_ini;
+ php_get_highlight_struct(&syntax_highlighter_ini);
+ highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC);
+ } else {
+ file_handle.type = ZEND_HANDLE_FILENAME;
+ file_handle.handle.fd = 0;
+ file_handle.filename = SG(request_info).path_translated;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
-static int lsapi_module_main(int show_source TSRMLS_DC)
-{
- zend_file_handle file_handle = {0};
-
- if (php_request_startup(TSRMLS_C) == FAILURE ) {
- return -1;
- }
- if (show_source) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC);
- } else {
- lsapi_execute_script( &file_handle TSRMLS_CC);
- }
- zend_try {
- php_request_shutdown(NULL);
- *argv0 = 0;
- } zend_end_try();
- return 0;
+ php_execute_script(&file_handle TSRMLS_CC);
+ }
+ zend_try {
+ php_request_shutdown(NULL);
+ } zend_end_try();
+ return 0;
}
static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen,
- void * arg )
+ void * arg )
{
- int type = ZEND_INI_PERDIR;
- if ( '\001' == *pKey ) {
- ++pKey;
- if ( *pKey == 4 ) {
- type = ZEND_INI_SYSTEM;
- }
- ++pKey;
- --keyLen;
- if (( keyLen == 7 )&&( strncasecmp( pKey, "engine", 6 )== 0 ))
- {
- if ( *pValue == '0' )
- engine = 0;
- }
- else
- zend_alter_ini_entry((char *)pKey, keyLen,
- (char *)pValue, valLen,
- type, PHP_INI_STAGE_ACTIVATE);
- }
- return 1;
+ int type = ZEND_INI_PERDIR;
+ if ( '\001' == *pKey ) {
+ ++pKey;
+ if ( *pKey == 4 ) {
+ type = ZEND_INI_SYSTEM;
+ }
+ ++pKey;
+ --keyLen;
+ zend_alter_ini_entry((char *)pKey, keyLen,
+ (char *)pValue, valLen,
+ type, PHP_INI_STAGE_ACTIVATE);
+ }
+ return 1;
}
static void override_ini()
{
- LSAPI_ForeachSpecialEnv( alter_ini, NULL );
+ LSAPI_ForeachSpecialEnv( alter_ini, NULL );
}
static int processReq( TSRMLS_D )
{
- int ret = 0;
- zend_first_try {
- /* avoid server_context==NULL checks */
- SG(server_context) = (void *) 1;
-
- engine = 1;
- override_ini();
-
- if ( engine ) {
- init_request_info( TSRMLS_C );
-
- if ( lsapi_module_main( source_highlight TSRMLS_CC ) == -1 ) {
- ret = -1;
- }
- } else {
- LSAPI_AppendRespHeader( "status: 403", 11 );
- LSAPI_AppendRespHeader( "content-type: text/html", 23 );
- LSAPI_Write( "Forbidden: PHP engine is disable.\n", 34 );
- }
- } zend_end_try();
- return ret;
+ int ret = 0;
+ zend_first_try {
+ /* avoid server_context==NULL checks */
+ SG(server_context) = (void *) 1;
+
+ init_request_info( TSRMLS_C );
+
+ override_ini();
+
+ if ( lsapi_module_main( source_highlight TSRMLS_CC ) == -1 ) {
+ ret = -1;
+ }
+ } zend_end_try();
+ return ret;
}
static void cli_usage( TSRMLS_D )
{
- static const char * usage =
- "Usage: php\n"
- " php -[b|c|h|i|q|s|v|?] [<file>] [args...]\n"
- " Run in LSAPI mode, only '-b', '-s' and '-c' are effective\n"
- " Run in Command Line Interpreter mode when parameters are specified\n"
- "\n"
- " -b <address:port>|<port> Bind Path for external LSAPI Server mode\n"
- " -c <path>|<file> Look for php.ini file in this directory\n"
- " -h This help\n"
- " -i PHP information\n"
- " -q Quiet-mode. Suppress HTTP Header output.\n"
- " -s Display colour syntax highlighted source.\n"
- " -v Version number\n"
- " -? This help\n"
- "\n"
- " args... Arguments passed to script.\n";
- php_output_startup();
- php_output_activate(TSRMLS_C);
- php_printf( "%s", usage );
+ static const char * usage =
+ "Usage: php\n"
+ " php -[b|c|h|i|q|s|v|?] [<file>] [args...]\n"
+ " Run in LSAPI mode, only '-b', '-s' and '-c' are effective\n"
+ " Run in Command Line Interpreter mode when parameters are specified\n"
+ "\n"
+ " -b <address:port>|<port> Bind Path for external LSAPI Server mode\n"
+ " -c <path>|<file> Look for php.ini file in this directory\n"
+ " -h This help\n"
+ " -i PHP information\n"
+ " -q Quiet-mode. Suppress HTTP Header output.\n"
+ " -s Display colour syntax highlighted source.\n"
+ " -v Version number\n"
+ " -? This help\n"
+ "\n"
+ " args... Arguments passed to script.\n";
+ php_output_startup();
+ php_output_activate(TSRMLS_C);
+ php_printf( "%s", usage );
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all(TSRMLS_C);
#else
@@ -612,250 +440,250 @@ static void cli_usage( TSRMLS_D )
}
static int parse_opt( int argc, char * argv[], int *climode,
- char **php_ini_path, char ** php_bind )
-{
- char ** p = &argv[1];
- char ** argend= &argv[argc];
- int c;
- while (( p < argend )&&(**p == '-' )) {
- c = *((*p)+1);
- ++p;
- switch( c ) {
- case 'b':
- if ( p >= argend ) {
- fprintf( stderr, "TCP or socket address must be specified following '-b' option.\n");
- return -1;
- }
- *php_bind = *p++;
- break;
-
- case 'c':
- if ( p >= argend ) {
- fprintf( stderr, "<path> or <file> must be specified following '-c' option.\n");
-
- return -1;
- }
- *php_ini_path = *p++;
- break;
- case 's':
- source_highlight = 1;
- break;
- case 'h':
- case 'i':
- case 'q':
- case 'v':
- case '?':
- default:
- *climode = 1;
- break;
- }
- }
- if ( p - argv < argc ) {
- *climode = 1;
- }
- return 0;
+ char **php_ini_path, char ** php_bind )
+{
+ char ** p = &argv[1];
+ char ** argend= &argv[argc];
+ int c;
+ while (( p < argend )&&(**p == '-' )) {
+ c = *((*p)+1);
+ ++p;
+ switch( c ) {
+ case 'b':
+ if ( p >= argend ) {
+ fprintf( stderr, "TCP or socket address must be specified following '-b' option.\n");
+ return -1;
+ }
+ *php_bind = *p++;
+ break;
+
+ case 'c':
+ if ( p >= argend ) {
+ fprintf( stderr, "<path> or <file> must be specified following '-c' option.\n");
+
+ return -1;
+ }
+ *php_ini_path = *p++;
+ break;
+ case 's':
+ source_highlight = 1;
+ break;
+ case 'h':
+ case 'i':
+ case 'q':
+ case 'v':
+ case '?':
+ default:
+ *climode = 1;
+ break;
+ }
+ }
+ if ( p - argv < argc ) {
+ *climode = 1;
+ }
+ return 0;
}
static int cli_main( int argc, char * argv[] )
{
- static const char * ini_defaults[] = {
- "report_zend_debug", "0",
- "display_errors", "1",
- "register_argc_argv", "1",
- "html_errors", "0",
- "implicit_flush", "1",
- "output_buffering", "0",
- "max_execution_time", "0",
- "max_input_time", "-1",
- NULL
- };
-
- const char ** ini;
- char ** p = &argv[1];
- char ** argend= &argv[argc];
- int ret = 0;
- int c;
- lsapi_mode = 0; /* enter CLI mode */
+ static const char * ini_defaults[] = {
+ "report_zend_debug", "0",
+ "display_errors", "1",
+ "register_argc_argv", "1",
+ "html_errors", "0",
+ "implicit_flush", "1",
+ "output_buffering", "0",
+ "max_execution_time", "0",
+ "max_input_time", "-1",
+ NULL
+ };
+
+ const char ** ini;
+ char ** p = &argv[1];
+ char ** argend= &argv[argc];
+ int ret = 0;
+ int c;
+ lsapi_mode = 0; /* enter CLI mode */
#ifdef PHP_WIN32
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
+ _fmode = _O_BINARY; /*sets default for file streams to binary */
+ setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
+ setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
+ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
#endif
- zend_first_try {
- SG(server_context) = (void *) 1;
-
- zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
- CG(in_compilation) = 0; /* not initialized but needed for several options */
- EG(uninitialized_zval_ptr) = NULL;
-
- for( ini = ini_defaults; *ini; ini+=2 ) {
- zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1,
- (char *)*(ini+1), strlen( *(ini+1) ),
- PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- }
-
- while (( p < argend )&&(**p == '-' )) {
- c = *((*p)+1);
- ++p;
- switch( c ) {
- case 'q':
- break;
- case 'i':
- if (php_request_startup(TSRMLS_C) != FAILURE) {
- php_print_info(0xFFFFFFFF TSRMLS_CC);
+ zend_first_try {
+ SG(server_context) = (void *) 1;
+
+ zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
+ CG(in_compilation) = 0; /* not initialized but needed for several options */
+ EG(uninitialized_zval_ptr) = NULL;
+
+ for( ini = ini_defaults; *ini; ini+=2 ) {
+ zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1,
+ (char *)*(ini+1), strlen( *(ini+1) ),
+ PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ }
+
+ while (( p < argend )&&(**p == '-' )) {
+ c = *((*p)+1);
+ ++p;
+ switch( c ) {
+ case 'q':
+ break;
+ case 'i':
+ if (php_request_startup(TSRMLS_C) != FAILURE) {
+ php_print_info(0xFFFFFFFF TSRMLS_CC);
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all(TSRMLS_C);
#else
php_end_ob_buffers(1 TSRMLS_CC);
#endif
- php_request_shutdown( NULL );
- }
- ret = 1;
- break;
- case 'v':
- if (php_request_startup(TSRMLS_C) != FAILURE) {
+ php_request_shutdown( NULL );
+ }
+ ret = 1;
+ break;
+ case 'v':
+ if (php_request_startup(TSRMLS_C) != FAILURE) {
#if ZEND_DEBUG
- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
#else
- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
+ php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2014 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
#endif
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all(TSRMLS_C);
#else
php_end_ob_buffers(1 TSRMLS_CC);
#endif
- php_request_shutdown( NULL );
- }
- ret = 1;
- break;
- case 'c':
- ++p;
- /* fall through */
- case 's':
- break;
-
- case 'h':
- case '?':
- default:
- cli_usage(TSRMLS_C);
- ret = 1;
- break;
-
- }
- }
- if ( !ret ) {
- if ( *p ) {
- zend_file_handle file_handle = {0};
-
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.handle.fp = VCWD_FOPEN(*p, "rb");
-
- if ( file_handle.handle.fp ) {
- script_filename = *p;
- php_self = *p;
-
- SG(request_info).path_translated = estrdup(*p);
- SG(request_info).argc = argc - (p - argv);
- SG(request_info).argv = p;
-
- if (php_request_startup(TSRMLS_C) == FAILURE ) {
- fclose( file_handle.handle.fp );
- ret = 2;
- } else {
- if (source_highlight) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC);
- } else {
- file_handle.filename = *p;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_execute_script(&file_handle TSRMLS_CC);
- }
-
- php_request_shutdown( NULL );
- }
- } else {
- php_printf("Could not open input file: %s.\n", *p);
- }
- } else {
- cli_usage(TSRMLS_C);
- }
- }
-
- }zend_end_try();
-
- php_module_shutdown(TSRMLS_C);
+ php_request_shutdown( NULL );
+ }
+ ret = 1;
+ break;
+ case 'c':
+ ++p;
+ /* fall through */
+ case 's':
+ break;
+
+ case 'h':
+ case '?':
+ default:
+ cli_usage(TSRMLS_C);
+ ret = 1;
+ break;
+
+ }
+ }
+ if ( !ret ) {
+ if ( *p ) {
+ zend_file_handle file_handle = {0};
+
+ file_handle.type = ZEND_HANDLE_FP;
+ file_handle.handle.fp = VCWD_FOPEN(*p, "rb");
+
+ if ( file_handle.handle.fp ) {
+ script_filename = *p;
+ php_self = *p;
+
+ SG(request_info).path_translated = *p;
+ SG(request_info).argc = argc - (p - argv);
+ SG(request_info).argv = p;
+
+ if (php_request_startup(TSRMLS_C) == FAILURE ) {
+ fclose( file_handle.handle.fp );
+ ret = 2;
+ } else {
+ if (source_highlight) {
+ zend_syntax_highlighter_ini syntax_highlighter_ini;
+
+ php_get_highlight_struct(&syntax_highlighter_ini);
+ highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC);
+ } else {
+ file_handle.filename = *p;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
+
+ php_execute_script(&file_handle TSRMLS_CC);
+ }
+
+ php_request_shutdown( NULL );
+ }
+ } else {
+ php_printf("Could not open input file: %s.\n", *p);
+ }
+ } else {
+ cli_usage(TSRMLS_C);
+ }
+ }
+
+ }zend_end_try();
+
+ php_module_shutdown(TSRMLS_C);
#ifdef ZTS
- tsrm_shutdown();
+ tsrm_shutdown();
#endif
- return ret;
+ return ret;
}
static int s_stop;
void litespeed_cleanup(int signal)
{
- s_stop = signal;
+ s_stop = signal;
}
void start_children( int children )
{
- struct sigaction act, old_term, old_quit, old_int, old_usr1;
- int running = 0;
- int status;
- pid_t pid;
-
- /* Create a process group */
- setsid();
-
- /* Set up handler to kill children upon exit */
- act.sa_flags = 0;
- act.sa_handler = litespeed_cleanup;
- if( sigaction( SIGTERM, &act, &old_term ) ||
- sigaction( SIGINT, &act, &old_int ) ||
- sigaction( SIGUSR1, &act, &old_usr1 ) ||
- sigaction( SIGQUIT, &act, &old_quit )) {
- perror( "Can't set signals" );
- exit( 1 );
- }
- s_stop = 0;
- while( 1 ) {
- while((!s_stop )&&( running < children )) {
- pid = fork();
- switch( pid ) {
- case 0: /* children process */
-
- /* don't catch our signals */
- sigaction( SIGTERM, &old_term, 0 );
- sigaction( SIGQUIT, &old_quit, 0 );
- sigaction( SIGINT, &old_int, 0 );
- sigaction( SIGUSR1, &old_usr1, 0 );
- return ;
- case -1:
- perror( "php (pre-forking)" );
- exit( 1 );
- break;
- default: /* parent process */
- running++;
- break;
- }
- }
- if ( s_stop ) {
- break;
- }
- pid = wait( &status );
- running--;
- }
- kill( -getpgrp(), SIGUSR1 );
- exit( 0 );
+ struct sigaction act, old_term, old_quit, old_int, old_usr1;
+ int running = 0;
+ int status;
+ pid_t pid;
+
+ /* Create a process group */
+ setsid();
+
+ /* Set up handler to kill children upon exit */
+ act.sa_flags = 0;
+ act.sa_handler = litespeed_cleanup;
+ if( sigaction( SIGTERM, &act, &old_term ) ||
+ sigaction( SIGINT, &act, &old_int ) ||
+ sigaction( SIGUSR1, &act, &old_usr1 ) ||
+ sigaction( SIGQUIT, &act, &old_quit )) {
+ perror( "Can't set signals" );
+ exit( 1 );
+ }
+ s_stop = 0;
+ while( 1 ) {
+ while((!s_stop )&&( running < children )) {
+ pid = fork();
+ switch( pid ) {
+ case 0: /* children process */
+
+ /* don't catch our signals */
+ sigaction( SIGTERM, &old_term, 0 );
+ sigaction( SIGQUIT, &old_quit, 0 );
+ sigaction( SIGINT, &old_int, 0 );
+ sigaction( SIGUSR1, &old_usr1, 0 );
+ return ;
+ case -1:
+ perror( "php (pre-forking)" );
+ exit( 1 );
+ break;
+ default: /* parent process */
+ running++;
+ break;
+ }
+ }
+ if ( s_stop ) {
+ break;
+ }
+ pid = wait( &status );
+ running--;
+ }
+ kill( -getpgrp(), SIGUSR1 );
+ exit( 0 );
}
@@ -863,185 +691,153 @@ void start_children( int children )
#include <fcntl.h>
int main( int argc, char * argv[] )
{
- int ret;
- int bindFd;
-
- char * php_ini_path = NULL;
- char * php_bind = NULL;
- char * p;
- int n;
- int climode = 0;
- struct timeval tv_req_begin;
- struct timeval tv_req_end;
- int slow_script_msec = 0;
- char time_buf[40];
-
+ int ret;
+ int bindFd;
+
+ char * php_ini_path = NULL;
+ char * php_bind = NULL;
+ char * p;
+ int n;
+ int climode = 0;
+
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE, SIG_IGN);
+ signal(SIGPIPE, SIG_IGN);
#endif
#endif
#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
+ tsrm_startup(1, 1, 0, NULL);
#endif
- if (argc > 1 ) {
- if ( parse_opt( argc, argv, &climode,
- &php_ini_path, &php_bind ) == -1 ) {
- return 1;
- }
- }
- if ( climode ) {
- lsapi_sapi_module.phpinfo_as_text = 1;
- }
- argv0 = argv[0] + strlen( argv[0] );
- sapi_startup(&lsapi_sapi_module);
+ if (argc > 1 ) {
+ if ( parse_opt( argc, argv, &climode,
+ &php_ini_path, &php_bind ) == -1 ) {
+ return 1;
+ }
+ }
+ if ( climode ) {
+ lsapi_sapi_module.phpinfo_as_text = 1;
+ }
+ sapi_startup(&lsapi_sapi_module);
#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);
+ 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;
+ SG(request_info).path_translated = NULL;
#endif
- lsapi_sapi_module.executable_location = argv[0];
-
- if ( php_ini_path ) {
- lsapi_sapi_module.php_ini_path_override = php_ini_path;
- }
+ lsapi_sapi_module.executable_location = argv[0];
+ if ( php_ini_path ) {
+ lsapi_sapi_module.php_ini_path_override = php_ini_path;
+ }
- lsapi_sapi_module.ini_defaults = sapi_lsapi_ini_defaults;
-
- if (php_module_startup(&lsapi_sapi_module, &litespeed_module_entry, 1) == FAILURE) {
+ if (php_module_startup(&lsapi_sapi_module, &litespeed_module_entry, 1) == FAILURE) {
#ifdef ZTS
- tsrm_shutdown();
+ tsrm_shutdown();
#endif
- return FAILURE;
- }
-
- if ( climode ) {
- return cli_main(argc, argv);
- }
-
- if ( php_bind ) {
- bindFd = LSAPI_CreateListenSock( php_bind, 10 );
- if ( bindFd == -1 ) {
- fprintf( stderr,
- "Failed to bind socket [%s]: %s\n", php_bind, strerror( errno ) );
- exit( 2 );
- }
- if ( bindFd != 0 ) {
- dup2( bindFd, 0 );
- close( bindFd );
- }
- }
-
- LSAPI_Init();
+ return FAILURE;
+ }
+
+ if ( climode ) {
+ return cli_main(argc, argv);
+ }
+
+
+ if ( php_bind ) {
+ bindFd = LSAPI_CreateListenSock( php_bind, 10 );
+ if ( bindFd == -1 ) {
+ fprintf( stderr,
+ "Failed to bind socket [%s]: %s\n", php_bind, strerror( errno ) );
+ exit( 2 );
+ }
+ if ( bindFd != 0 ) {
+ dup2( bindFd, 0 );
+ close( bindFd );
+ }
+ }
+
+ LSAPI_Init();
- LSAPI_Init_Env_Parameters( NULL );
-
- slow_script_msec = LSAPI_Get_Slow_Req_Msecs();
-
- if ( php_bind ) {
- LSAPI_No_Check_ppid();
- }
-
- while( LSAPI_Prefork_Accept_r( &g_req ) >= 0 ) {
- if ( slow_script_msec ) {
- gettimeofday( &tv_req_begin, NULL );
- }
- ret = processReq(TSRMLS_C);
- if ( slow_script_msec ) {
- gettimeofday( &tv_req_end, NULL );
- n = ((long) tv_req_end.tv_sec - tv_req_begin.tv_sec ) * 1000
- + (tv_req_end.tv_usec - tv_req_begin.tv_usec) / 1000;
- if ( n > slow_script_msec )
- {
- strftime( time_buf, 30, "%d/%b/%Y:%H:%M:%S", localtime( &tv_req_end.tv_sec ) );
- fprintf( stderr, "[%s] Slow PHP script: %d ms\n URL: %s %s\n Query String: %s\n Script: %s\n",
- time_buf, n, LSAPI_GetRequestMethod(),
- LSAPI_GetScriptName(), LSAPI_GetQueryString(),
- LSAPI_GetScriptFileName() );
-
- }
- }
- LSAPI_Finish();
- if ( ret ) {
- break;
- }
- }
- php_module_shutdown(TSRMLS_C);
+ LSAPI_Init_Env_Parameters( NULL );
+
+ if ( php_bind ) {
+ LSAPI_No_Check_ppid();
+ }
+
+ while( LSAPI_Prefork_Accept_r( &g_req ) >= 0 ) {
+ ret = processReq(TSRMLS_C);
+ LSAPI_Finish();
+ if ( ret ) {
+ break;
+ }
+ }
+ php_module_shutdown(TSRMLS_C);
#ifdef ZTS
- tsrm_shutdown();
+ tsrm_shutdown();
#endif
- return ret;
+ return ret;
}
/* LiteSpeed PHP module starts here */
-#if PHP_MAJOR_VERSION > 4
-
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO(arginfo_litespeed__void, 0)
ZEND_END_ARG_INFO()
/* }}} */
-#else
-#define arginfo_litespeed__void NULL
-#endif
-
PHP_FUNCTION(litespeed_request_headers);
PHP_FUNCTION(litespeed_response_headers);
PHP_MINFO_FUNCTION(litespeed);
zend_function_entry litespeed_functions[] = {
- PHP_FE(litespeed_request_headers, arginfo_litespeed__void)
- PHP_FE(litespeed_response_headers, arginfo_litespeed__void)
- PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
- {NULL, NULL, NULL}
+ PHP_FE(litespeed_request_headers, arginfo_litespeed__void)
+ PHP_FE(litespeed_response_headers, arginfo_litespeed__void)
+ PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
+ PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
+ PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
+ {NULL, NULL, NULL}
};
static PHP_MINIT_FUNCTION(litespeed)
{
- /* REGISTER_INI_ENTRIES(); */
- return SUCCESS;
+ /* REGISTER_INI_ENTRIES(); */
+ return SUCCESS;
}
static PHP_MSHUTDOWN_FUNCTION(litespeed)
{
- /* UNREGISTER_INI_ENTRIES(); */
- return SUCCESS;
+ /* UNREGISTER_INI_ENTRIES(); */
+ return SUCCESS;
}
zend_module_entry litespeed_module_entry = {
- STANDARD_MODULE_HEADER,
- "litespeed",
- litespeed_functions,
- PHP_MINIT(litespeed),
- PHP_MSHUTDOWN(litespeed),
- NULL,
- NULL,
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ STANDARD_MODULE_HEADER,
+ "litespeed",
+ litespeed_functions,
+ PHP_MINIT(litespeed),
+ PHP_MSHUTDOWN(litespeed),
+ NULL,
+ NULL,
+ NULL,
+ NO_VERSION_YET,
+ STANDARD_MODULE_PROPERTIES
};
static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen,
- void * arg )
+ void * arg )
{
- add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 );
- return 1;
+ add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 );
+ return 1;
}
@@ -1049,14 +845,13 @@ static int add_associate_array( const char * pKey, int keyLen, const char * pVal
Fetch all HTTP request headers */
PHP_FUNCTION(litespeed_request_headers)
{
- /* TODO: */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
- array_init(return_value);
+ /* TODO: */
+ if (ZEND_NUM_ARGS() > 0) {
+ WRONG_PARAM_COUNT;
+ }
+ array_init(return_value);
- if ( lsapi_mode )
- LSAPI_ForeachOrgHeader( add_associate_array, return_value );
+ LSAPI_ForeachOrgHeader( add_associate_array, return_value );
}
/* }}} */
@@ -1067,40 +862,40 @@ PHP_FUNCTION(litespeed_request_headers)
Fetch all HTTP response headers */
PHP_FUNCTION(litespeed_response_headers)
{
- sapi_header_struct *h;
- zend_llist_position pos;
- char * p;
- int len;
- char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (!&SG(sapi_headers).headers) {
- RETURN_FALSE;
- }
- array_init(return_value);
-
- h = zend_llist_get_first_ex(&SG(sapi_headers).headers, &pos);
- while (h) {
- if ( h->header_len > 0 ) {
- p = strchr( h->header, ':' );
- len = p - h->header;
- if (( p )&&( len > 0 )) {
- memmove( headerBuf, h->header, len );
- while( len > 0 && (isspace( headerBuf[len-1])) ) {
- --len;
- }
- headerBuf[len] = 0;
- if ( len ) {
- while( isspace(*++p));
- add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 );
- }
- }
- }
- h = zend_llist_get_next_ex(&SG(sapi_headers).headers, &pos);
- }
+ sapi_header_struct *h;
+ zend_llist_position pos;
+ char * p;
+ int len;
+ char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
+
+ if (ZEND_NUM_ARGS() > 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ if (!&SG(sapi_headers).headers) {
+ RETURN_FALSE;
+ }
+ array_init(return_value);
+
+ h = zend_llist_get_first_ex(&SG(sapi_headers).headers, &pos);
+ while (h) {
+ if ( h->header_len > 0 ) {
+ p = strchr( h->header, ':' );
+ len = p - h->header;
+ if (( p )&&( len > 0 )) {
+ memmove( headerBuf, h->header, len );
+ while( len > 0 && (isspace( headerBuf[len-1])) ) {
+ --len;
+ }
+ headerBuf[len] = 0;
+ if ( len ) {
+ while( isspace(*++p));
+ add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 );
+ }
+ }
+ }
+ h = zend_llist_get_next_ex(&SG(sapi_headers).headers, &pos);
+ }
}
/* }}} */
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 1bb16b3268..24b5a7e559 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -86,7 +86,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static int g_inited = 0;
static int g_running = 1;
static int s_ppid;
-static int s_slow_req_msecs = 0;
LSAPI_Request g_req = { -1, -1 };
void Flush_RespBuf_r( LSAPI_Request * pReq );
@@ -508,13 +507,11 @@ static int parseRequest( LSAPI_Request * pReq, int totalLen )
return 0;
}
-static int s_accept_notify = 0;
-
static struct lsapi_packet_header ack = {'L', 'S',
LSAPI_REQ_RECEIVED, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} };
-static inline int notify_req_received( int fd )
+static inline int notify_req_received( LSAPI_Request * pReq )
{
- if ( write( fd, &ack, LSAPI_PACKET_HEADER_LEN )
+ if ( write( pReq->m_fd, &ack, LSAPI_PACKET_HEADER_LEN )
< LSAPI_PACKET_HEADER_LEN ) {
return -1;
}
@@ -570,10 +567,7 @@ static int readReq( LSAPI_Request * pReq )
pReq->m_bufProcessed = packetLen;
pReq->m_reqState = LSAPI_ST_REQ_BODY | LSAPI_ST_RESP_HEADER;
- if ( !s_accept_notify )
- return notify_req_received( pReq->m_fd );
- else
- return 0;
+ return notify_req_received( pReq );
}
@@ -683,10 +677,6 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
setsockopt(pReq->m_fd, IPPROTO_TCP, TCP_NODELAY,
(char *)&nodelay, sizeof(nodelay));
}
-
- if ( s_accept_notify )
- return notify_req_received( pReq->m_fd );
-
}
} else {
return -1;
@@ -1249,13 +1239,12 @@ int LSAPI_ForeachHeader_r( LSAPI_Request * pReq,
while( pCur < pEnd ) {
pKey = pReq->m_pHttpHeader + pCur->nameOff;
keyLen = pCur->nameLen;
- if ( keyLen > 250 ) {
- keyLen = 250;
- }
-
pKeyEnd = pKey + keyLen;
memcpy( achHeaderName, "HTTP_", 5 );
p = &achHeaderName[5];
+ if ( keyLen > 250 ) {
+ keyLen = 250;
+ }
while( pKey < pKeyEnd ) {
char ch = *pKey++;
@@ -1640,9 +1629,6 @@ static int lsapi_accept( int fdListen )
setsockopt( fd, IPPROTO_TCP, TCP_NODELAY,
(char *)&nodelay, sizeof(nodelay));
}
-
- if ( s_accept_notify )
- notify_req_received( fd );
}
return fd;
@@ -2087,15 +2073,6 @@ void LSAPI_Set_Server_Max_Idle_Secs( int serverMaxIdle )
}
}
-void LSAPI_Set_Slow_Req_Msecs( int msecs )
-{
- s_slow_req_msecs = msecs;
-}
-
-int LSAPI_Get_Slow_Req_Msecs()
-{
- return s_slow_req_msecs;
-}
void LSAPI_No_Check_ppid()
{
@@ -2149,18 +2126,6 @@ void LSAPI_Init_Env_Parameters( fn_select_t fp )
avoidFork = atoi( p );
}
- p = getenv( "LSAPI_ACCEPT_NOTIFY" );
- if ( p ) {
- s_accept_notify = atoi( p );
- }
-
- p = getenv( "LSAPI_SLOW_REQ_MSECS" );
- if ( p ) {
- n = atoi( p );
- LSAPI_Set_Slow_Req_Msecs( n );
- }
-
-
#if defined( RLIMIT_CORE )
p = getenv( "LSAPI_ALLOW_CORE_DUMP" );
if ( !p ) {
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 45934ad464..9d6255b327 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -343,11 +343,6 @@ void LSAPI_Set_Max_Process_Time( int secs );
void LSAPI_Init_Env_Parameters( fn_select_t fp );
-void LSAPI_Set_Slow_Req_Msecs( int msecs );
-
-int LSAPI_Get_Slow_Req_Msecs( );
-
-
#if defined (c_plusplus) || defined (__cplusplus)
}
#endif
diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4
index 48c7a5d804..4bcad80bb4 100644
--- a/sapi/milter/config.m4
+++ b/sapi/milter/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_WITH(milter, for Milter support,
-[ --with-milter[=DIR] Build PHP as Milter application], no, no)
+[ --with-milter[=DIR] Build PHP as Milter application], no, no)
if test "$PHP_MILTER" != "no"; then
if test "$PHP_MILTER" = "yes"; then
diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4
index 7859481508..347a74ca06 100644
--- a/sapi/pi3web/config.m4
+++ b/sapi/pi3web/config.m4
@@ -3,7 +3,7 @@ dnl $Id$
dnl
PHP_ARG_WITH(pi3web, for Pi3Web support,
-[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no)
+[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no)
if test "$PHP_PI3WEB" != "no"; then
if test "$PHP_PI3WEB" = "yes"; then
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
index 9b0bb90c35..7601b0c1ed 100644
--- a/sapi/roxen/config.m4
+++ b/sapi/roxen/config.m4
@@ -7,7 +7,7 @@ PHP_ARG_WITH(roxen,,
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)
+[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no)
RESULT=
AC_MSG_CHECKING([for Roxen/Pike support])