OpCache and Shared Hosting Environment
Hi.
I was wondering what approach you have adopted as a "root" admin when it comes to:
Did you enable timestamp_validation to speed up changes or was it disabled? Thanks!
opcache.validate_timestamps=1
opcache.revalidate_freq=2
Did you enable timestamp_validation to speed up changes or was it disabled? Thanks!
-
I just searched for few details and found out what it does : ========================== When this is enabled, PHP will check the file timestamp per your opcache.revalidate_freq value. When it's disabled, opcache.revaliate_freq is ignored and PHP files are NEVER checked for updated code. So, if you modify your code, the changes won't actually run until you restart or reload PHP =========================== Ideally for security I feel it should be enabled, but if its related to speed then it should disabled. 0 -
I do keep the defaults, they do good enough, additionally you can't expect users or software to support validate_timestamps=0 - it can seriously break things. 0 -
I just searched for few details and found out what it does : Ideally for security I feel it should be enabled, but if its related to speed then it should disabled.
It is tricky kind of situation because it is always better when everything gets cleared so one doesn't run into issues with cache but then, the issue I mentioned earlier when this is enabled. As you also rightly pointed out, enabling this comes with some performance hit. It is more like trying to find that sweet balance between caching PHP code for performance, but not having to restart the web server each time some PHP code is edited/generated by customers.0 -
I don't know how you are using PHP. But if you're allowing opcache_reset() then you could be clearing the OpCache for everyone. If you are allowing opcache_get_status() then you could be potentially allowing any of your shared hosting accounts to know information about opcache'd scripts on other hosting accounts. I think these issues could be alleviated if file based opcache was used. But as far as I know, cPanel has never enabled it. And the feature request to enable it (which even includes the one line of code change that is required to make file based opcaching available in the feature request) is stuck in feature request purgatory. Enable file-based OpCache for PHP 7.0/7.1 0 -
Hello, I don't know how you are using PHP. But if you're allowing opcache_reset() then you could be clearing the OpCache for everyone. If you are allowing opcache_get_status() then you could be potentially allowing any of your shared hosting accounts to know information about opcache'd scripts on other hosting accounts. I think these issues could be alleviated if file based opcache was used. But as far as I know, cPanel has never enabled it. And the feature request to enable it (which even includes the one line of code change that is required to make file based opcaching available in the feature request) is stuck in feature request purgatory.
When you're in a shared hosting environment, you should use a handler that is run under suexec, that can be fastcgi/fcgid or lsphp - so running opcache_reset() won't reveal anything about other users/customers, because the shared memory segment used by opcache is only for that given user.0 -
Hello, I've moved this to our EasyApache forum. Thanks! 0
Please sign in to leave a comment.
Comments
7 comments