\n");
}
/* }}} */
/* {{{ module_name_cmp */
static int module_name_cmp(Bucket *f, Bucket *s)
{
return strcasecmp(((zend_module_entry *)Z_PTR(f->val))->name,
((zend_module_entry *)Z_PTR(s->val))->name);
}
/* }}} */
/* {{{ php_print_info */
PHPAPI ZEND_COLD void php_print_info(int flag)
{
char **env, *tmp1, *tmp2;
zend_string *php_uname;
if (!sapi_module.phpinfo_as_text) {
php_print_info_htmlhead();
} else {
php_info_print("phpinfo()\n");
}
if (flag & PHP_INFO_GENERAL) {
const char *zend_version = get_zend_version();
char temp_api[10];
php_uname = php_get_uname('a');
if (!sapi_module.phpinfo_as_text) {
php_info_print_box_start(1);
}
if (!sapi_module.phpinfo_as_text) {
time_t the_time;
struct tm *ta, tmbuf;
the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);
php_info_print("
tm_mon==3) && (ta->tm_mday==1)) {
php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" />");
} else {
php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" />");
}
}
if (!sapi_module.phpinfo_as_text) {
php_info_printf("
PHP Version %s
\n", PHP_VERSION);
} else {
php_info_print_table_row(2, "PHP Version", PHP_VERSION);
}
php_info_print_box_end();
php_info_print_table_start();
php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
php_info_print_table_row(2, "Build Date", php_build_date);
#ifdef PHP_BUILD_SYSTEM
php_info_print_table_row(2, "Build System", PHP_BUILD_SYSTEM);
#endif
if (php_build_provider()) {
php_info_print_table_row(2, "Build Provider", php_build_provider());
}
#ifdef PHP_BUILD_COMPILER
php_info_print_table_row(2, "Compiler", PHP_BUILD_COMPILER);
#endif
#ifdef PHP_BUILD_ARCH
php_info_print_table_row(2, "Architecture", PHP_BUILD_ARCH);
#endif
#ifdef CONFIGURE_COMMAND
php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
#endif
if (sapi_module.pretty_name) {
php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
}
#ifdef VIRTUAL_DIR
php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
#else
php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
#endif
php_info_print_table_row(2, "Configuration File (php.ini) Path", PHP_CONFIG_FILE_PATH);
php_info_print_table_row(2, "Loaded Configuration File", php_ini_opened_path ? php_ini_opened_path : "(none)");
php_info_print_table_row(2, "Scan this dir for additional .ini files", php_ini_scanned_path ? php_ini_scanned_path : "(none)");
php_info_print_table_row(2, "Additional .ini files parsed", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
snprintf(temp_api, sizeof(temp_api), "%d", PHP_API_VERSION);
php_info_print_table_row(2, "PHP API", temp_api);
snprintf(temp_api, sizeof(temp_api), "%d", ZEND_MODULE_API_NO);
php_info_print_table_row(2, "PHP Extension", temp_api);
snprintf(temp_api, sizeof(temp_api), "%d", ZEND_EXTENSION_API_NO);
php_info_print_table_row(2, "Zend Extension", temp_api);
php_info_print_table_row(2, "Zend Extension Build", ZEND_EXTENSION_BUILD_ID);
php_info_print_table_row(2, "PHP Extension Build", ZEND_MODULE_BUILD_ID);
snprintf(temp_api, sizeof(temp_api), "%d bits", SIZEOF_ZEND_LONG * 8);
php_info_print_table_row(2, "PHP Integer Size", temp_api);
#if ZEND_DEBUG
php_info_print_table_row(2, "Debug Build", "yes" );
#else
php_info_print_table_row(2, "Debug Build", "no" );
#endif
#ifdef ZTS
php_info_print_table_row(2, "Thread Safety", "enabled" );
php_info_print_table_row(2, "Thread API", tsrm_api_name() );
#else
php_info_print_table_row(2, "Thread Safety", "disabled" );
#endif
#ifdef ZEND_SIGNALS
php_info_print_table_row(2, "Zend Signal Handling", "enabled" );
#else
php_info_print_table_row(2, "Zend Signal Handling", "disabled" );
#endif
php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm() ? "enabled" : "disabled" );
{
const zend_multibyte_functions *functions = zend_multibyte_get_functions();
char *descr;
if (functions) {
spprintf(&descr, 0, "provided by %s", functions->provider_name);
} else {
descr = estrdup("disabled");
}
php_info_print_table_row(2, "Zend Multibyte Support", descr);
efree(descr);
}
#ifdef ZEND_MAX_EXECUTION_TIMERS
php_info_print_table_row(2, "Zend Max Execution Timers", "enabled" );
#else
php_info_print_table_row(2, "Zend Max Execution Timers", "disabled" );
#endif
#ifdef HAVE_IPV6
php_info_print_table_row(2, "IPv6 Support", "enabled" );
#else
php_info_print_table_row(2, "IPv6 Support", "disabled" );
#endif
#ifdef HAVE_DTRACE
php_info_print_table_row(2, "DTrace Support", (zend_dtrace_enabled ? "enabled" : "available, disabled"));
#else
php_info_print_table_row(2, "DTrace Support", "disabled" );
#endif
php_info_print_stream_hash("PHP Streams", php_stream_get_url_stream_wrappers_hash());
php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash());
php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash());
php_info_print_table_end();
/* Zend Engine */
php_info_print_box_start(0);
if (!sapi_module.phpinfo_as_text) {
php_info_print("
;)
\n");
}
php_info_print("This program makes use of the Zend Scripting Language Engine:");
php_info_print(!sapi_module.phpinfo_as_text?"
":"\n");
if (sapi_module.phpinfo_as_text) {
php_info_print(zend_version);
} else {
zend_html_puts(zend_version, strlen(zend_version));
}
php_info_print_box_end();
zend_string_free(php_uname);
}
zend_ini_sort_entries();
if (flag & PHP_INFO_CONFIGURATION) {
php_info_print_hr();
if (!sapi_module.phpinfo_as_text) {
php_info_print("
Configuration
\n");
} else {
SECTION("Configuration");
}
if (!(flag & PHP_INFO_MODULES)) {
SECTION("PHP Core");
display_ini_entries(NULL);
}
}
if (flag & PHP_INFO_MODULES) {
HashTable sorted_registry;
zend_module_entry *module;
zend_hash_init(&sorted_registry, zend_hash_num_elements(&module_registry), NULL, NULL, 1);
zend_hash_copy(&sorted_registry, &module_registry, NULL);
zend_hash_sort(&sorted_registry, module_name_cmp, 0);
ZEND_HASH_MAP_FOREACH_PTR(&sorted_registry, module) {
if (module->info_func || module->version) {
php_info_print_module(module);
}
} ZEND_HASH_FOREACH_END();
SECTION("Additional Modules");
php_info_print_table_start();
php_info_print_table_header(1, "Module Name");
ZEND_HASH_MAP_FOREACH_PTR(&sorted_registry, module) {
if (!module->info_func && !module->version) {
php_info_print_module(module);
}
} ZEND_HASH_FOREACH_END();
php_info_print_table_end();
zend_hash_destroy(&sorted_registry);
}
if (flag & PHP_INFO_ENVIRONMENT) {
SECTION("Environment");
php_info_print_table_start();
php_info_print_table_header(2, "Variable", "Value");
tsrm_env_lock();
for (env=environ; env!=NULL && *env !=NULL; env++) {
tmp1 = estrdup(*env);
if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
efree(tmp1);
continue;
}
*tmp2 = 0;
tmp2++;
php_info_print_table_row(2, tmp1, tmp2);
efree(tmp1);
}
tsrm_env_unlock();
php_info_print_table_end();
}
if (flag & PHP_INFO_VARIABLES) {
zval *data;
SECTION("PHP Variables");
php_info_print_table_start();
php_info_print_table_header(2, "Variable", "Value");
if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) {
php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_P(data));
}
if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) {
php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_P(data));
}
if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) {
php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_P(data));
}
if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) {
php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_P(data));
}
php_print_gpcse_array(ZEND_STRL("_REQUEST"));
php_print_gpcse_array(ZEND_STRL("_GET"));
php_print_gpcse_array(ZEND_STRL("_POST"));
php_print_gpcse_array(ZEND_STRL("_FILES"));
php_print_gpcse_array(ZEND_STRL("_COOKIE"));
php_print_gpcse_array(ZEND_STRL("_SERVER"));
php_print_gpcse_array(ZEND_STRL("_ENV"));
php_info_print_table_end();
}
if (flag & PHP_INFO_CREDITS) {
php_info_print_hr();
php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE);
}
if (flag & PHP_INFO_LICENSE) {
if (!sapi_module.phpinfo_as_text) {
SECTION("License");
php_info_print_box_start(0);
php_info_print("
\n");
php_info_print("PHP is free software. You may redistribute it and/or modify it under the ");
php_info_print("terms of the Modified BSD License (SPDX-License-Identifier: BSD-3-Clause).\n");
php_info_print("
\n");
php_info_print("
\n");
php_info_print("Copyright © The PHP Group and Contributors.
\n");
php_info_print("Copyright © Zend Technologies Ltd., a subsidiary company of Perforce Software, Inc.\n");
php_info_print("
\n");
php_info_print("
\n");
php_info_print("Redistribution and use in source and binary forms, with or without ");
php_info_print("modification, are permitted provided that the following conditions are met:\n");
php_info_print("
\n");
php_info_print("
\n");
php_info_print("- Redistributions of source code must retain the above copyright notice, this ");
php_info_print("list of conditions and the following disclaimer.
\n");
php_info_print("- Redistributions in binary form must reproduce the above copyright notice, ");
php_info_print("this list of conditions and the following disclaimer in the documentation ");
php_info_print("and/or other materials provided with the distribution.
\n");
php_info_print("- Neither the name of the copyright holder nor the names of its ");
php_info_print("contributors may be used to endorse or promote products derived from ");
php_info_print("this software without specific prior written permission.
\n");
php_info_print("
\n");
php_info_print("
\n");
php_info_print("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" ");
php_info_print("AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ");
php_info_print("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ");
php_info_print("DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ");
php_info_print("FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ");
php_info_print("DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ");
php_info_print("SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ");
php_info_print("CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ");
php_info_print("OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ");
php_info_print("OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n");
php_info_print("
\n");
php_info_print_box_end();
} else {
php_info_print("\n");
php_info_print("License\n");
php_info_print("\n");
php_info_print("PHP is free software. You may redistribute it and/or modify it under the\n");
php_info_print("terms of the Modified BSD License (SPDX-License-Identifier: BSD-3-Clause).\n");
php_info_print("\n");
php_info_print("Copyright © The PHP Group and Contributors.\n");
php_info_print("Copyright © Zend Technologies Ltd., a subsidiary company of\n");
php_info_print(" Perforce Software, Inc.\n");
php_info_print("\n");
php_info_print("Redistribution and use in source and binary forms, with or without\n");
php_info_print("modification, are permitted provided that the following conditions are met:\n");
php_info_print("\n");
php_info_print("1. Redistributions of source code must retain the above copyright notice, this\n");
php_info_print(" list of conditions and the following disclaimer.\n");
php_info_print("\n");
php_info_print("2. Redistributions in binary form must reproduce the above copyright notice,\n");
php_info_print(" this list of conditions and the following disclaimer in the documentation\n");
php_info_print(" and/or other materials provided with the distribution.\n");
php_info_print("\n");
php_info_print("3. Neither the name of the copyright holder nor the names of its\n");
php_info_print(" contributors may be used to endorse or promote products derived from\n");
php_info_print(" this software without specific prior written permission.\n");
php_info_print("\n");
php_info_print("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n");
php_info_print("AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n");
php_info_print("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n");
php_info_print("DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n");
php_info_print("FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n");
php_info_print("DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n");
php_info_print("SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n");
php_info_print("CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n");
php_info_print("OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n");
php_info_print("OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n");
}
}
if (!sapi_module.phpinfo_as_text) {
php_info_print("
");
}
}
/* }}} */
PHPAPI ZEND_COLD void php_info_print_table_start(void) /* {{{ */
{
if (!sapi_module.phpinfo_as_text) {
php_info_print("