PHP7 OpCache / Compiled Byte-Code Optimizers / Security


Well-Known Member
Aug 10, 2002
cPanel Access Level
Root Administrator
Since there doesn't appear to be a lot of traction concerning this topic from the Zend OPcache and PHP-FPM post. I thought I'd ask here. Perhaps it's just not a paramount issue for everyone and there's no need for discussion. Or perhaps few people are aware of the issues.

In that thread it was pointed out that OpCache probably isn't a good thing to have enabled in a shared hosting environment. Based on the shared memory aspect of it, I would tend to agree.

However, this makes me wonder if there is a compiled byte-code optimizer that is recommended for shared hosting? XCache would appear to be a valid alternative for PHP 5.6. Or are there arguments against this? But XCache only works for up to PHP 5.6. It is not being developed for PHP 7.0 and PHP 7.1, which is where the PHP landscape is headed.

So is there a compiled byte-code optimizer for PHP 7.0 and PHP 7.1 that would be recommended for shared hosting?

Would using file-caching in OpCache for PHP 7.0 and PHP 7.1 be an effective alternative? File caching in OpCache was introduced in PHP 7.0 and does not exist for PHP 5.6. However, cPanel's PHP 7.0 opCache does not have this enabled. The PHP 7.0 opCache module is not compiled with --enable-opcache-file. Is there a reason for this?

I'm not sure how effective OpCache file caching really is. I'm also not sure if it solves any of the security implications from a shared memory model. It would seem to (as long as it's done properly) because the files would be owned by the account owner. You would just need to be sure to set:

php_admin_flag[opcache.file_cache_only] = 1
php_admin_value[opcache.file_cache] = /home/%user%/.opcache
and make sure /home/%user%/.opcache exists and is owned by %user%.

But again, this would require that cPanel's PHP 7.0 and PHP 7.1 builds to compile opCache with --enable-opcache-file.

So to summarize:

For PHP 5.6 using Xcache instead of opCache would seem to be a better solution for a compiled byte-code optimizer - XCache in EasyApache4 - although with PHP 7.0 / PHP 7.1 becoming more of the norm, I'm not sure how much time would really be dedicated to this.

For PHP 7.0 and PHP 7.0 cPanel should release opCache compiled with --enable-opcache-file so that server administrators at least have the option of using file caching.


Staff member
Apr 11, 2011

I'll leave this thread open for the additional user-feedback you are seeking, however note that generally this type of discussion is better handled on our feature request website.

There is some discussion on the following StackOverflow thread that may help as well:

Is there any compatible memory cache for PHP 7?

For PHP 7.0 and PHP 7.0 cPanel should release opCache compiled with --enable-opcache-file so that server administrators at least have the option of using file caching.
I encourage you to open a feature request to seek out additional feedback on this request. The feature request site is where you will receive direct input from our Community Manager and developers.

Thank you.