From ded12158ccf112860864d390d96913426a9debe7 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 14 Feb 2013 13:19:06 +0400 Subject: [PATCH] Fixed phpinfo() output when O+ is not enabled for CLI --- ZendAccelerator.c | 7 ++++++- zend_accelerator_module.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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"); -- 2.50.1