• Resolved kollinio

    (@kollinio)


    Hi!

    I get this error thrown on the Statistics page:

     Fatal error: Uncaught Error: Division by zero
    in /wordpress/wp-content/plugins/flush-opcache/admin/flush-opcache-statistics.php on line 25

    Call stack:

    1. require_once()
      wp-content/plugins/flush-opcache/admin/class-flush-opcache-admin.php:212
    2. Flush_Opcache_Admin::page_statistics()
      wp-content/plugins/flush-opcache/admin/class-flush-opcache-admin.php:103
    3. Flush_Opcache_Admin::flush_opcache_admin_page()
      wp-includes/class-wp-hook.php:308
    4. WP_Hook::apply_filters()
      wp-includes/class-wp-hook.php:332
    5. WP_Hook::do_action()
      wp-includes/plugin.php:517
    6. do_action()
      wp-admin/admin.php:259

    Also flushing the opcache doesn’t work.

    What might be the problem?

    • This topic was modified 1 year, 8 months ago by kollinio.
    • This topic was modified 1 year, 8 months ago by kollinio.
Viewing 10 replies - 1 through 10 (of 10 total)
  • 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.

    Thread Starter kollinio

    (@kollinio)

    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.

    Thread Starter kollinio

    (@kollinio)

    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)

    If in doubt, this is the best place to check OPcache configuration : https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.file-cache

    Thread Starter kollinio

    (@kollinio)

    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 1 year, 8 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 !

    Thread Starter kollinio

    (@kollinio)

    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 ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Fatal error on Statistics page & cache not flushing’ is closed to new replies.