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

ItsMattSon

Well-Known Member
Sep 5, 2016
182
38
103
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?
 

ItsMattSon

Well-Known Member
Sep 5, 2016
182
38
103
Perth
cPanel Access Level
Root Administrator
Also, regarding the php.ini changes, ensure they are added to the following file for PHP 5.6:

Code:
/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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
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:

Code:
/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:

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.
 
  • Like
Reactions: ItsMattSon

ItsMattSon

Well-Known Member
Sep 5, 2016
182
38
103
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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello,

The changes made in that file are preserved through updates.

Thank you.
 
  • Like
Reactions: ItsMattSon