Best Practice to enable/configure OPCache w/ EA4:PHP7+PHP-FPM
cPanel 60 with EasyApache4
php7 + php-fpm + OPCache
I see /opt/cpanel/ea-php70/root/etc/php.d/10-opcache.ini has directives to in place enable and configure OPCache, and phpinfo page shows that the file was parsed in scan for additional .ini files yet OPCache is not showing up as enabled...?
I did get OPCache working at one point - had just reinstalled the module and it seemed to just start working - however, at that point I was unable to change the settings (eg. opcache.fast_shutdown=1) at all despite apache restarts after every attempt (tried /opt/cpanel/ea-php70/root/etc/php.d/10-opcache.ini /opt/cpanel/ea-php70/root/etc/php.d/local.ini /opt/cpanel/ea-php70/root/etc/php.ini and even /usr/local/lib/php.ini). I tried editing the files manually and also tried the MultiPHP INI Editor.
Since then I managed to break things somehow while trying to get a config change to happen and OPCache is no longer working... will likely need to reinstall stuff.
I have a well-known managed hosting provider for this server yet, so far, they seem to be having a hard time answering the Qs below in a way that works... I'm starting to wonder if something is not functioning properly.
So, the Qs are (EA4 w/ PHP7):
1) best practice how/where to enable OPCache once installed?
2) best practice how/where to change/add settings (eg. opcache.memory_consumption=) once enabled?
-
From a consol as root check if opcache is installed: php -v
If it is then in /opt/cpanel/ea-php70/root/etc/php.d/10-opcache.in check if its enabled:; Determines if Zend OPCache is enabled opcache.enable=1
Make sure any comment ( ; ) in front of opcache.enable=1 is removed. If php -v shows opcache not installed then run EA4 again0 -
Hello, Please also review the following thread for information on how to edit the PHP configuration values for a domain name when PHP-FPM is enabled on the account: Enabling PHP-FPM in MultiPHP Manager Thank you. 0 -
Same problem as OP opcache is working fine, however I can not figure out where the "global" settings are being set from. I've looked in all of the locations where the loaded .ini files reside but I am unable to find where the top level setting is coming from. The ini editor "should" supercede anything before it, so... what comes after other than the user folder which doesn't even have a .ini (.user.ini nor php.ini)? I need to change the memory from 96 to a higher number (need to figure out the higher number now that FPM is available to make opcache work) but I can't figure out where to set it. PHP editor should work, but it isn't, regardless of opcache.memory_consumption or zend_optimizerplus.memory_consumption being set to a number different than 96. Just short of disabling Zendguard and re-enabling it, I'm not sure where else to go or what to do. I'll keep digging, but I'm pretty confused at this point. 0 -
Definitely a bug that needs addressed. The ONLY way to make changes is first through the PHP MulitINI Editor, then you MUST go over to PHP Manager, tick off the appropriate PHP version for the domain and hit apply, REGARDLESS of whether or not it is already set. Did not test against inherited domains since my lowest PHP version is 5.4 and opcache setup is different for 5.4. So, in order to make changes, you have to apply the PHP version through PHP Manager after setting it in the INI editor. Making a change and "saving", will not reflect in phpinfo. Restarting the httpd after saving, will not reflect in phpinfo. After saving and then re-applying the PHP version for a set of domains, WILL reflect in phpinfo. Tested against completely removing PHP55, then installing it and moving my PHP56 domain to instead use PHP55. This move reflected the 55 ini opcache settings. It was only after moving my 56 domain over to 55 for testing, then back to 56 that I was able to observe the 56 ini settings were now in effect. I then went into the editor, made a few more changes, saved and it did not reflect. Only after re-visiting the manager and re-applying 56 for the domain, did the new changes reflect for the 56 ini. All of this said, it is assumed you are using PHP-FPM and it is "ON". 0 -
...so, the changes should be made in /opt/cpanel/ea-php70/root/etc/php.d/10-opcache.ini then systemctl restart ea-php70-php-fpm.service systemctl restart httpd
the bit I was missing was restarting php-fpm, hope that helps ;)0 -
Since I haven't messed with 7 yet, I don't know about the 10-opcache.ini vs php.ini for the settings (which place is better) But, @MaxFein, what you're saying is that php-fpm must be restarted as well, which means it isn't getting restarted anytime the phpini editor is edited. (for 55 and 56). This is probably going to frustrate a handful of people. IMO, whatever triggers a restart of httpd after saving the PHP INI editor, also needs to check for and restart the appropriate php-fpm service as well. 0 -
Definitely a bug that needs addressed. ... So, in order to make changes, you have to apply the PHP version through PHP Manager after setting it in the INI editor. Making a change and "saving", will not reflect in phpinfo. Restarting the httpd after saving, will not reflect in phpinfo. After saving and then re-applying the PHP version for a set of domains, WILL reflect in phpinfo.
I can confirm that this bug affected me also (for domains that are explicitly set to use PHP-FPM) whereby always_populate_raw_post_data was apparently set to 0, despite it being uncommented and set to -1 in MultiPHP INI Editor. Had to re-apply the PHP Version, despite it already having ea-php56 set. Once re-applied, phpinfo showed always_populate_raw_post_data set as -1, as per how I set it in the MultiPHP INI Editor. Is this a bug? (Sure seems to be)0 -
Hello, The issue with changes made via the MultiPHP INI Editor when PHP-FPM is enabled is discussed on the following thread: EA4, php.ini editor while using FPM Thank you. 0
Please sign in to leave a comment.
Comments
8 comments