summaryrefslogtreecommitdiff
path: root/sapi/embed/php_embed.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2007-08-02 23:45:28 +0000
committerStanislav Malyshev <stas@php.net>2007-08-02 23:45:28 +0000
commitf361b07629bbd1da16f8b6d647f4131988ce496d (patch)
tree296d816c8648169308191bda63f66d8f4367ade8 /sapi/embed/php_embed.c
parent864a08d1cb90e4fe24e3c189ef7b0d8e0ee45955 (diff)
downloadphp-git-f361b07629bbd1da16f8b6d647f4131988ce496d.tar.gz
use hardcoded ini like CLI
Diffstat (limited to 'sapi/embed/php_embed.c')
-rw-r--r--sapi/embed/php_embed.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 5cb6e64ac0..48644efadc 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -24,6 +24,14 @@
#include <fcntl.h>
#endif
+#define HARDCODED_INI \
+ "html_errors=0\n" \
+ "register_argc_argv=1\n" \
+ "implicit_flush=1\n" \
+ "output_buffering=0\n" \
+ "max_execution_time=0\n" \
+ "max_input_time=-1\n"
+
static char* php_embed_read_cookies(TSRMLS_D)
{
return NULL;
@@ -141,6 +149,7 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
sapi_globals_struct *sapi_globals;
void ***tsrm_ls;
#endif
+ int ini_entries_len = 0;
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
@@ -173,6 +182,11 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
*ptsrm_ls = tsrm_ls;
#endif
+ ini_entries_len = strlen(HARDCODED_INI);
+ php_embed_module.ini_entries = malloc(ini_entries_len+2);
+ memcpy(php_embed_module.ini_entries, HARDCODED_INI, ini_entries_len+1);
+ php_embed_module.ini_entries[ini_entries_len+1] = 0;
+
sapi_startup(&php_embed_module);
if (php_embed_module.startup(&php_embed_module)==FAILURE) {
@@ -187,11 +201,12 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
/* Set some Embedded PHP defaults */
SG(options) |= SAPI_OPTION_NO_CHDIR;
- zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
- zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-
+#if 0
+// zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+// zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+// zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+// zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+#endif
SG(request_info).argc=argc;
SG(request_info).argv=argv;
@@ -215,6 +230,10 @@ void php_embed_shutdown(TSRMLS_D)
#ifdef ZTS
tsrm_shutdown();
#endif
+ if (php_embed_module.ini_entries) {
+ free(php_embed_module.ini_entries);
+ php_embed_module.ini_entries = NULL;
+ }
}
/*