]> granicus.if.org Git - php/commitdiff
Fixed phpinfo() output when O+ is not enabled for CLI
authorDmitry Stogov <dmitry@zend.com>
Thu, 14 Feb 2013 09:19:06 +0000 (13:19 +0400)
committerDmitry Stogov <dmitry@zend.com>
Thu, 14 Feb 2013 09:19:06 +0000 (13:19 +0400)
ZendAccelerator.c
zend_accelerator_module.c

index 8b2a6ae48e73c5ed0bb4419a095bfad933c6303f..3e9ea12e7a49a14e2a068530d0993c556f2f2e68 100644 (file)
@@ -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;
        }
 
index e64ad19e3c8a589d19e160d4bd4ca39e53d315b8..d26a773bbf85c477bde7b7b0798aec002bee6030 100644 (file)
@@ -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");