OPcache

Discussion in 'ISPConfig 3 Priority Support' started by variable99, Oct 3, 2024 at 11:08 AM.

  1. variable99

    variable99 Member HowtoForge Supporter

    So, today I was introduced to OPcache... One of the users run to the issue when SHM was overloaded and performance degraded. From php.ini configs and fpm pool.d configs I see that OPcache is not utilized. Is this something not recommended?
    Tasks:
    1. Enable OPcache by default in all PHP versions;
    2. Set opcache.file_cache to the users /var/www/user/opcache folder;
    3. Set permissions to user:user /var/www/user/opcache and chmod 0755 /var/www/user/opcache
    Is this enough?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Opcache is normally enabled by default, and it caches in RAM, so it does not need a folder. So I wonder why you think that cache is not used.

    You can test it like this:

    Code:
    php -i | grep "opcache.enable"
    In the output you shall see this if its on:

    Code:
    opcache.enable => On => On
    For php-fpm, you can use a file with phpinfo() function inside.
     
  3. variable99

    variable99 Member HowtoForge Supporter

    It is used, but only in SHM mode. There is users with wordpress sites which gobles up default 128 MB RAM allotment, so as a backup file cache should be used.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, so the opcache is on and is being used. You can try, to see if file caching gives any benefits, but especially for WordPress users, it's probably better to use one of the WordPress caches that caches the rendered pages as files instead of letting opcache write the parsed PHP code to a file.
     
    Nicram likes this.

Share This Page