Skip to main content

Best Practice to enable/configure OPCache w/ EA4:PHP7+PHP-FPM

Comments

8 comments

  • kernow
    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 again
    0
  • cPanelMichael
    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
  • philsward
    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
  • philsward
    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
  • MaxFein
    ...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
  • philsward
    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
  • ItsMattSon
    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
  • cPanelMichael
    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.