The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'EasyApache' started by ItsMattSon, Jan 14, 2017.

Tags:
  1. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    125
    Likes Received:
    27
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi all,

    Can somebody advise whether I need to edit the /usr/local/lib/php.ini file to configure Opcache or can I copy the config out of there and put it at the bottom of the MultiPHP Editor ea-php56 PHP INI?

    I'd really rather not have them so separate.. and also I'm worried editing usr-local-lib php ini is the wrong thing to do since I thought all changes to the PHP INI should be made via MultiPHP?

    Could someone tell me how I should be going about it?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    ItsMattSon likes this.
  3. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    125
    Likes Received:
    27
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator

    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?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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:

    Code:
    /opt/cpanel/ea-php56/root/etc/php.ini
    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:

    Code:
    rpm -qa|grep ea-php56-php-zendguard
    If so, the file path you are looking for is:

    Code:
    /opt/cpanel/ea-php56/root/etc/php.d/zendguard.ini
    Thank you.
     
    ItsMattSon likes this.
  5. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    125
    Likes Received:
    27
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    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?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The changes made in that file are preserved through updates.

    Thank you.
     
    ItsMattSon likes this.
Loading...

Share This Page