You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
opcache: Improve error message when OPcache is enabled dynamically
The error message will now advice on the `php_admin_value[opcache.enable]=1`
mistake. It will also send the message to OPcache’s logging facility instead of
the regular error handling logic during startup so that it will not be made
available to `error_get_last()`, since it is related to a specific request and
thus not actionable by a script either.
#19146 made a related change to `opcache.memory_consumption`.
Copy file name to clipboardExpand all lines: ext/opcache/zend_accelerator_module.c
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -167,7 +167,15 @@ static ZEND_INI_MH(OnEnable)
167
167
returnSUCCESS;
168
168
}
169
169
170
-
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME" can't be temporary enabled (it may be only disabled till the end of request)");
170
+
if (stage==ZEND_INI_STAGE_ACTIVATE) {
171
+
if (strcmp(sapi_module.name, "fpm-fcgi") ==0) {
172
+
zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME" can't be temporary enabled. Are you using php_admin_value[opcache.enable]=1 in an individual pool's configuration?");
173
+
} else {
174
+
zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME" can't be temporary enabled (it may be only disabled till the end of request)");
175
+
}
176
+
} else {
177
+
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME" can't be temporary enabled (it may be only disabled till the end of request)");
Setting opcache.enable via php_admin_value fails gracefully
3
+
--SKIPIF--
4
+
<?phpinclude"skipif.inc"; ?>
5
+
--FILE--
6
+
<?php
7
+
8
+
require_once"tester.inc";
9
+
10
+
$cfg = <<<EOT
11
+
[global]
12
+
error_log = {{FILE:LOG}}
13
+
[unconfined]
14
+
listen = {{ADDR}}
15
+
pm = static
16
+
pm.max_children = 1
17
+
catch_workers_output = yes
18
+
php_admin_value[opcache.enable] = On
19
+
php_admin_flag[display_errors] = On
20
+
php_admin_flag[display_startup_errors] = On
21
+
php_admin_flag[log_errors] = On
22
+
EOT;
23
+
24
+
$code = <<<EOT
25
+
<?php
26
+
var_dump(error_get_last());
27
+
EOT;
28
+
29
+
$tester = newFPM\Tester($cfg, $code);
30
+
$tester->start(iniEntries: [
31
+
'opcache.enable' => '0',
32
+
'opcache.log_verbosity_level' => '2',
33
+
]);
34
+
$tester->expectLogStartNotices();
35
+
$tester->expectLogPattern("/Zend OPcache can't be temporary enabled. Are you using php_admin_value\\[opcache.enable\\]=1 in an individual pool's configuration?/");
0 commit comments