From: Dmitry Stogov Date: Thu, 14 Feb 2013 09:19:06 +0000 (+0400) Subject: Fixed phpinfo() output when O+ is not enabled for CLI X-Git-Tag: php-5.5.0beta1~42^2~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ded12158ccf112860864d390d96913426a9debe7;p=php Fixed phpinfo() output when O+ is not enabled for CLI --- diff --git a/ZendAccelerator.c b/ZendAccelerator.c index 8b2a6ae48e..3e9ea12e7a 100644 --- a/ZendAccelerator.c +++ b/ZendAccelerator.c @@ -2255,7 +2255,12 @@ static int accel_startup(zend_extension *extension) /* no supported SAPI found - disable acceleration and stop initalization */ if( accel_find_sapi(TSRMLS_C) == FAILURE ){ ZCG(startup_ok) = 0; - zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI and FastCGI SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); + if (!ZCG(accel_directives).enable_cli && + strcmp(sapi_module.name, "cli")==0) { + zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb TSRMLS_CC); + } else { + zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM and FastCGI SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); + } return SUCCESS; } diff --git a/zend_accelerator_module.c b/zend_accelerator_module.c index e64ad19e3c..d26a773bbf 100644 --- a/zend_accelerator_module.c +++ b/zend_accelerator_module.c @@ -373,7 +373,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS) } else { php_info_print_table_row(2, "Opcode Caching", "Disabled"); } - if (ZCG(enabled) && ZCG(accel_directives).optimization_level) { + if (ZCG(enabled) && ZCG(startup_ok) && ZCSG(accelerator_enabled) && ZCG(accel_directives).optimization_level) { php_info_print_table_row(2, "Optimization", "Enabled"); } else { php_info_print_table_row(2, "Optimization", "Disabled");