amnuts / opcache-gui

A clean, effective and responsive interface for Zend OPcache
1.23k stars 198 forks source link

Notice for file_cache_only #81

Closed frayber closed 2 years ago

frayber commented 2 years ago

Hello, I saw many notices like this in logs:

_PHP Notice: Undefined index: opcache.file_cacheonly in /var/www/smart/opcache.php on line 187

In my opcache there isn't this option, so I modified line 187, from:

if ($config['directives']['opcache.file_cache_only']) {

to:

if (isset($config['directives']['opcache.file_cache_only']) && $config['directives']['opcache.file_cache_only'] == 1) {

MichaIng commented 2 years ago

Interesting, this directive should be always defined: https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.file-cache-only

Which PHP version are you using?

frayber commented 2 years ago

php 5.6.40 on a centos 7 machine with remi repositories, Zend OPcache 7.0.6-dev

amnuts commented 2 years ago

OK, that would explain it. Looking at the opcache source code, that directive isn't in 5.6.40 - https://github.com/php/php-src/blob/4b8f72da5dfb201af4e82dee960261d8657e414f/ext/opcache/zend_accelerator_module.c#L254 - it is in the 7.0 code, though - https://github.com/php/php-src/blob/bd289af9630f827728b32360bcd09a614aae8f23/ext/opcache/zend_accelerator_module.c#L318

The opcache-gui is meant for only PHP 7.1+ (in the composer.json you'll find "php": ">=7.1.0",). So you may find code that doesn't quite work for you as well as directives that are not there.