Plugin Author
nierdz
(@mnttech)
Hi @kollinio
Could you give me your full OPcache configuration ? There must be something weird in it to produce this error.
zend_extension=opcache.so;
opcache.enable=1;
opcache.memory_consumption=64;
opcache.interned_strings_buffer=8;
opcache.max_accelerated_files=3000;
opcache.revalidate_freq=180;
opcache.fast_shutdown=0;
opcache.enable_cli=0;
opcache.revalidate_path=0;
opcache.validate_timestamps=1;
opcache.max_file_size=0;
opcache.file_cache=/htdocs/.opcache;
opcache.file_cache_only=1;
Plugin Author
nierdz
(@mnttech)
Hi @kollinio
This is because you force to use file cache only with opcache.file_cache_only=1;
With this setting, you disable entirely in memory cache and you’re slowing dramatically your website. You should remove it unless you have a good reason to do so.
I’ll probably add something to avoid such ugly errors and maybe some warning to prevent to activate such options.
Thank you. After applying this changes, the statistics show up. Still, manually flushing the opcache by clicking the button in your plugin doesn’t work. I get a success message but when I check the directory, it still has all the files in it.
Plugin Author
nierdz
(@mnttech)
Nope, it works fine. When you hit invalidate button, it reloads WordPress and the file you just invalidated is going again in OPcache so it’s still present on your Opcache folder. You can test it by creating a new file in your WordPress installation, for example, test.php. Go on this page with you browser and invalidate it from the plugin file. This will not be present in your OPcache folder until you browse it again.
By the way, you should avoid using file cache instead of memory cache as it’s way more performant to use memory (at least 20 times faster). In fact, you should totally disable this file cache option and grow your memory cache according to your needs.
Plugin Author
nierdz
(@mnttech)
I created a test.php the way you suggested. It shows up in the opcache folder. Unfortunately after flushing the opcache it still remains in this folder.
-
This reply was modified 2 years, 11 months ago by
kollinio.
Plugin Author
nierdz
(@mnttech)
I just tested it and it works as expected. Before flushing the file :
root@aded5a9ba1fc:/var/www/html# stat /tmp/opcache/a28660b13ec8dd40160f4e3495027793/var/www/html/test.php.bin
File: /tmp/opcache/a28660b13ec8dd40160f4e3495027793/var/www/html/test.php.bin
Size: 848 Blocks: 8 IO Block: 4096 regular file
Device: 0,79 Inode: 15735084 Links: 1
Access: (0600/-rw-------) Uid: ( 33/www-data) Gid: ( 33/www-data)
Access: 2023-07-23 17:18:27.514523360 +0000
Modify: 2023-07-23 17:18:27.514523360 +0000
Change: 2023-07-23 17:18:27.514523360 +0000
Birth: 2023-07-23 17:18:27.514523360 +0000
And after :
root@aded5a9ba1fc:/var/www/html# stat /tmp/opcache/a28660b13ec8dd40160f4e3495027793/var/www/html/test.php.bin
stat: cannot statx '/tmp/opcache/a28660b13ec8dd40160f4e3495027793/var/www/html/test.php.bin': No such file or directory
But this is not really important. The real information here is:
YOU SHOULD NOT USE THIS DAMN CACHE FILE THINGS ! NOT USE IT !
thank you for your support. I already disabled the file_cache_only.
I wonder why my hoster suggests the settings that I used initially: https://www.ionos.de/digitalguide/websites/web-entwicklung/websites-beschleunigen-mit-php-7-und-opcache/
Plugin Author
nierdz
(@mnttech)
Because disks are cheaper than RAM š