SOLVED Zend OPcache and PHP-FPM

RWH Tech

Well-Known Member
Oct 1, 2015
86
16
8
Brazil
cPanel Access Level
Root Administrator
Andrew took a look and didn't add any new info to what we know, save for a suggestion to use file caching set on ~/opcache, which I reckon is an option, albeit a slow one.
He didn't mention anything about my config, and it is stock(save for Apache with HTTP2), so all checks out there.
 

sparek-3

Well-Known Member
Aug 10, 2002
1,984
218
343
cPanel Access Level
Root Administrator
There is a patch for opcache file collisions in a chroot'd environment

http://git.php.net/?p=php-src.git;a=patch;h=ecba563f2fa1e027ea91b9ee0d50611273852995

It is detailed near the bottom of:

PHP :: Request #69090 :: add prefix/xor to cache keys/check permissions or separate caches

I can confirm that it does solve the collision problems when using opcache in a chroot'd environment. Is this a patch that cPanel needs to include in their PHP offering? Or do you think PHP will include it in later releases (Note the patch was first created on November 15th, 5 days after PHP 5.6.28 was released).

This bug only seems to affect opcache in a chroot'd environment. I doubt many cPanel users are using php-fpm chroots (I doubt many cPanel users are using php-fpm period).


All that being said, I'm left to agree with @cPanelMichael and the people from ServerFault that using OpCache in any shared hosting environment isn't recommended. The new question is, is there a compiled byte-code optimizer that is recommended for shared hosting environments? In the original post to this thread I mentioned Xcache as being a possible replacement, given it's xcache.var_namespace_mode and xcache.var_namespace variables. But Xcache only works up to PHP 5.6 and I don't think there are any plans to continue it with PHP 7.0 or PHP 7.1.

It's also important to note that most people have been or probably still are using suPHP as their PHP Handler. No compiled byte-code optimizer works with suPHP (at least that I am aware of). So the lack of OpCache, Xcache, or any compiled byte-code optimizer probably isn't much of a detriment as one might think.
 
  • Like
Reactions: RWH Tech

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
There is a patch for opcache file collisions in a chroot'd environment

http://git.php.net/?p=php-src.git;a=patch;h=ecba563f2fa1e027ea91b9ee0d50611273852995

It is detailed near the bottom of:

PHP :: Request #69090 :: add prefix/xor to cache keys/check permissions or separate caches

I can confirm that it does solve the collision problems when using opcache in a chroot'd environment. Is this a patch that cPanel needs to include in their PHP offering? Or do you think PHP will include it in later releases (Note the patch was first created on November 15th, 5 days after PHP 5.6.28 was released).

This bug only seems to affect opcache in a chroot'd environment. I doubt many cPanel users are using php-fpm chroots (I doubt many cPanel users are using php-fpm period).
A resolution for that particular PHP bug is included with the latest PHP versions:

PHP: PHP 7 ChangeLog
PHP: PHP 5 ChangeLog

You can search for "69090" on the above links to see it's inclusion. Those versions are not yet included with EA4, as the most recent PHP versions must go through our own testing and build process before publication. You can monitor the EA4 change log to see when updated PHP versions are included with EA4.

EasyApache 4 Change Log - EasyApache 4 - cPanel Documentation

Thank you.
 
  • Like
Reactions: RWH Tech