What are the basic prerequisites to enable PHP opcache

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,330
74
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello guys. I'm trying to enable a server to use PHP opcache as I did in other EA4 installs, but is not installing it.

I discovered after repeated compilations and trial and error, that to enable opcache, EA4 requires to precompile the system including:
  • Apache MPM: mpm_worker
  • Apache modules: mod_suphp + mod_suexec + mod_cgid + mod_proxy_fcgi
  • PHP modules: php_build + php_devel + php_runtime + php-fpm + php-opcache + php-zendguard (?)
In some servers this combination made the trick, but there is one of them not obbeying and opcache is not being included in phpinfo reports :(
Can you confirm if this is ok or may I be missing something important?

Best regards
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello,

The https://documentation.cpanel.net/display/EA4/PHP+Options document notes the following warnings regarding OPcache:

  • EasyApache 4 does not currently support any opcode cacher other than OPCache.
  • Opcode caching programs are not compatible with the suPHP or CGI PHP handlers. The caching program either does not function, or functions incorrectly.
  • The system does not automatically configure OPCache. If you do not manually configure OPCache after you install it, it will provide no benefits.
  • We strongly recommend the DSO PHP handler for the OPCache opcode cacher.
  • Do not install multiple PHP caching programs on the same system. Multiple opcode caching programs consume excessive memory and degrade system performance.
Also, note that it's unsupported with PHP version 5.4.

Thank you.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,330
74
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello @cPanelMichael, thanks for answering. I'm already aware of all these recomendations. I was trying to enable OPCache under PHP 5.6.25, with Apache 2.4 using mpm_worker and the modules I listed above, which are theoretically compatible with it. In fact, I cloned one of the default templates that are currently shipped with cPanel, which already include OPCache, but it just don't integrate the OPCache PHP module when provisioning, it just ignores the request to do that.

I also tried to find the DSO Apache module but it's not present in the list of options.

So, should I open a ticket? or may this be a EA4 bug?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,330
74
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
ok @cPanelMichael, it's frustrating but I started following the feature request and monitor page changes in the Current Status of EasyApache 4 - EasyApache 4 - cPanel Documentation and also in EA4 changelog to see when it is available. (for those also interested: you can monitor changes in webpages with this free webservice).


Well now I have 3 more questions:
1) As per the performance solution, what would you recommend to reach the best possible speed without fcgi in crowded servers (+200 accounts)? Maybe mod_cgi + PHP opcache + apache mpm_worker?

2) If fcgi is not supported, why are these modules present in the EA4 options:
  • ea-apache24-mod_cgid
  • ea-apache24-mod_proxy_fcgi
  • ea-php55-php-fpm
  • ea-php56-php-fpm
  • ea-php70-php-fpm
3) What's the difference between ea-apache24-mod_cgid and ea-apache24-mod_cgi?

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
1) As per the performance solution, what would you recommend to reach the best possible speed without fcgi in crowded servers (+200 accounts)? Maybe mod_cgi + PHP opcache + apache mpm_worker?
It's difficult to predict the performance results, as it varies based on individual server usage.

2) If fcgi is not supported, why are these modules present in the EA4 options:
  • ea-apache24-mod_cgid
  • ea-apache24-mod_proxy_fcgi
  • ea-php55-php-fpm
  • ea-php56-php-fpm
  • ea-php70-php-fpm
Those packages were present to allow users to follow instructions from the "Configure PHP-FPM with User Pools for EasyApache 4" document. While it's still possible to follow those instructions, it's highly discouraged. The instructions from that document are not compatible with the actual FPM support in cPanel version 60.

3) What's the difference between ea-apache24-mod_cgid and ea-apache24-mod_cgi?
Both are available, depending on the selected MPM. Threaded MPMs (Event and Worker) work with mod_cgid. Prefork, the only forking MPM, uses mod_cgi.

Thank you.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,330
74
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Ok, thanks for the clarifications.

So, usage of *-php-fpm modules is officially discouraged? Still, using opcache seems to be the closest approach to a PHP optimization by now. Is this correct?


Both are available, depending on the selected MPM. Threaded MPMs (Event and Worker) work with mod_cgid. Prefork, the only forking MPM, uses mod_cgi.
So, mod_cgid is completely unrelated to fcgid. Similar names but not similar functionality. Is this correct?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
So, mod_cgid is completely unrelated to fcgid. Similar names but not similar functionality. Is this correct?
That's correct. Here's documentation on both:

mod_fcgid - FastCGI interface module for Apache 2 - The Apache HTTP Server Project
mod_cgid - Apache HTTP Server Version 2.4

So, usage of *-php-fpm modules is officially discouraged? Still, using opcache seems to be the closest approach to a PHP optimization by now. Is this correct?
Yes, the use of those RPMs is discouraged until cPanel version 60. Also, yes, EasyApache 4 does not currently support any opcode cacher other than OPCache.

Thanks!