Skip to main content

Do I edit /usr/local/lib/php.ini to setup Opcache

Comments

5 comments

  • cPanelMichael
    Hello, There's a post on this topic at: OPCache config in EA4 Thank you.
    0
  • ItsMattSon
    Also, regarding the php.ini changes, ensure they are added to the following file for PHP 5.6:
    /opt/cpanel/ea-php56/root/etc/php.d/opcache.ini
    Thank you.

    Hi @cPanelMichael, I have set up my server using SuPHP as PHP Handler, and then "applied" the PHP-FPM option to the account which started OPcache to show "cache hits" whereby before it didn't. So far, so good (i hope). I hope I haven't set this up wrong so far (since I know SuPHP isn't compatible, but PHP-FPM is?) I ended up editing /usr/local/lib/php.ini and uncommenting all the OPcache lines, which I'm now not sure this is what is supposed to be done? I looked for your recommended opcache.ini file in /opt/cpanel/ea-php56/root/etc/php.d/ but I'm afraid there are no files in there with 'opcache' in it. Is that a sign that I've already configured OPcache wrong? Or do I need to manually create it and move all OPcache config lines into there and OPcache automatically uses it?
    0
  • cPanelMichael
    I ended up editing /usr/local/lib/php.ini and uncommenting all the OPcache lines, which I'm now not sure this is what is supposed to be done?

    Global php.ini edits need to occur on the specific version of PHP when using EasyApache 4. For example, with PHP 5.6, the path is:
    /opt/cpanel/ea-php56/root/etc/php.ini
    I looked for your recommended opcache.ini file in /opt/cpanel/ea-php56/root/etc/php.d/ but I'm afraid there are no files in there with 'opcache' in it. Is that a sign that I've already configured OPcache wrong? Or do I need to manually create it and move all OPcache config lines into there and OPcache automatically uses it?

    With PHP 5.6, Opcache is assoicated with the ZendGuard package. You can verify if the associated RPM for OPcache with PHP 5.6 is installed with a command such as:
    rpm -qa|grep ea-php56-php-zendguard
    If so, the file path you are looking for is:
    /opt/cpanel/ea-php56/root/etc/php.d/zendguard.ini
    Thank you.
    0
  • ItsMattSon
    Thanks @cPanelMichael! I re-commented out the OPcache config lines in /usr/local/lib/php.ini and copied them into /opt/cpanel/ea-php56/root/etc/php.d/zendguard.ini instead. A note for PHP-FPM, I had to re-Apply the PHP version in MultipPHP Manager for phpinfo to reflect the Directives I changed the values for (Non-php-fpm domains didn't need this extra step). One last question for you and I'm sorted! Is the zendguard.ini overwritten across cPanel updates? Will I lose the config I put in there?
    0
  • cPanelMichael
    Hello, The changes made in that file are preserved through updates. Thank you.
    0

Please sign in to leave a comment.