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.

OPCache config in EA4

Discussion in 'EasyApache' started by Yukinarija, Nov 15, 2016.

Tags:
  1. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hey,

    Installed OpCache for 5.6 and 7.0. By default it works fine in 7.0, in 5.6 it seems to always 'miss' on at least one of my projects.

    Where's the config for opcache stored though? php.ini doesn't have anything representative, and adding some config like this:

    opcache.enable=1
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=4000
    opcache.revalidate_freq=60
    opcache.fast_shutdown=1
    opcache.enable_cli=1


    at the end - doesn't change the default values. Is there any default opcache config somewhere for 5.6 and 7.0 separately? I will start searching the system for string matches.

    Cheers.
     
  2. roliboli

    roliboli Active Member

    Joined:
    Sep 3, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Switzerland
    Hi
    the settings are per modul and PHP version specific:
    /opt/cpanel/ea-php56/root/etc/php.d/10-opcache.ini
    /opt/cpanel/ea-php70/root/etc/php.d/10-opcache.ini

    But my problem is that OpCache is not working. I have the recommende configuration with php-mpm prefork. But the documentations says that the all cgi-handlers are not compatible with OpCache (PHP Options - EasyApache 4 - cPanel Documentation "Opcode caching programs are not compatible with the suPHP or CGI PHP handlers. The caching program either does not function, or functions incorrectly.")

    So after provisioning with extension OpCache the module is enabled. But there are only misses. Do you have the same problem?

    Regards
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    The "Warnings" section under the Opcache section on the following document explains some key considerations:

    PHP Options - EasyApache 4 - cPanel Documentation

    It notes:

    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.
     
  4. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hey roliboli, yep - same issue. But somehow with 7.0 and CGI it starts hitting - strange. I hope that it works with fCGI as well as with DSO PHP. For our needs we could even use DSO, so it's pretty okay.


    Thanks Michael.
     
  5. roliboli

    roliboli Active Member

    Joined:
    Sep 3, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Switzerland
    Hi Michael

    So there is no possibility to have OpCache with php-fpm (prefork)? It makes no sense to activate OpCache because the apachebench shows slower values instead more speed. Both php7 and php56. Actually we have on another server EA3 with fcgid and OpCache which is much faster than the php-fpm.

    DSO is not possible for me because I need the process running under user rights.

    Regards
     
  6. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hey roli,

    They replied to me in an another thread saying that fCGI is not available until version 62 IIRC. Only DSO+OpCache is possible in EA4.
    Overall, as much as I like PHP7, if you can't use DSO (like I can't in one of our servers), need to revert back to EA3 then until 62 and fCGI.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    It's possible to use OPCache with PHP-FPM, yes.

    Regarding FastCGI, PHP-FPM is similar to FastCGI, but there are differences to how they are configured to work (e.g. PHP-FPM uses mod_proxy_fcgi as it's backend). Support for mod_fcgid in cPanel version 62 provides the same FastCGI handler that was offered in EasyApache 3. This is discussed under the comments section at:

    EasyApache 4 mod_fcgid

    Thank you.
     
  8. roliboli

    roliboli Active Member

    Joined:
    Sep 3, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Switzerland
    Hi Michael

    But in the documentation is writtten: "Opcode caching programs are not compatible with the suPHP or CGI PHP handlers". So in my point of view PHP-FPM is meant for "CGI PHP handlers".

    I installed mainly mod_mpm_prefork, mod_ruid2, php-fpm (EA4: Cpanel Default). Then OpCache can be enabled but it producess always misses and the performance is slower than without OpCache.

    Regards
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @roliboli,

    Could you elaborate a little more on your last response? Are you suggesting we update the PHP Options document to include support for PHP-FPM and Opcache?

    Thank you.
     
  10. roliboli

    roliboli Active Member

    Joined:
    Sep 3, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Switzerland
    I don't now if the documentation is correct. Because you say that PHP-FPM is working with OpCache. But with mod_mpm_prefork, mod_ruid2, php-fpm (default config) OpCache doesn't work correct (in my opinion). I think PHP-FPM uses the CGI Handler.

    All I want to have is a PHP-FPM configuration (not DSO) with working OpCache for better performance.

    Best regards
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Could you test with Mod_Ruid2 disabled and see if you notice similar results? Here's some alternatives for symlink protection if you need to disable Mod_Ruid2:

    EasyApache4 symlink race protection

    Thank you.
     
  12. roliboli

    roliboli Active Member

    Joined:
    Sep 3, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Switzerland
    I disabled Mod_Ruid2 and there are only misses in both PHP7 and PHP56. Do you have a EA4 configuration with working OpCache? But I need CGI because the process should be executed under the user.

    Regards
     
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @roliboli,

    Could you open a support ticket using the link in my signature so we can review your system's specific configuration and verify why OPcache isn't working?

    Thank you.
     
  14. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hey guys,

    Turns out I did not read the replies right, so if somebody was also confused -> OPCache config in EA4


    I am now using PHP 7.0 with PHP-FPM, in the GUI 'CGI' is selected, phpinfo shows:

    FPM/FastCGI


    And Zend OpCache is actually working and being hit. File for config is available here: /opt/cpanel/ea-php70/root/etc/php.d/10-zend.ini

    So yeah, OpCache works like this. And PHP-FPM uses the mod_fcgid, rather than straight FCGID, but I am not sure how much worse that is? I'd love to compare when we get a proper FCGID. Maybe somebody could inform me? I am happy that I came back to check, I can now increase Zend limits.
     
  15. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    You can find a recent update on it's availability under the comments section of the related feature request at:

    EasyApache 4 mod_fcgid

    Thank you.
     
Loading...

Share This Page