opcache - where to change settings?
Started using opcache with php 7.3 and mod_lsapi. Handler is set to lsapi in multiphp manager. I am NOT using php-fpm and using inherited php on all domains (7.3). I do not have domain specific php.ini files in place - all use the global.
I have looked on the forums and everything points to additional steps when using php-fpm, but I am not using that. There have been no lines added in the php.ini using multiphp ini editor in whm - I expected them to be there like any other module.
Where are these default settings being declared at and where is the correct place to edit them so those edits will not be removed on updates?
-
To add to this. I would like to have account specific opcache settings. I just created a php.ini file for an account's /home/ folder with : ; disable opcache since I use this for development opcache.enable = 0 This account is still actively using opcache and running though. Shouldn't this local php.ini override this particular setting and disable opcache for this entire account? 0 -
Already saw and read those Lauren. I am not using php-fpm. I did find where to edit the setting (/opt/cpanel/ea-php73/root/etc/php.d/10-opcache.ini), but do not know if those will 'stay' if updates are made or not. Editing files directly with whm/cpanel 'usually' never keeps the settings after an update unless they are entered in a specific place/way. They don't answer my question about trying to disable opcache with an account specific php.ini either. Maybe that is not possible to do? I'm not sure - so I am asking. 0 -
That .ini file is editable and we don't make any configuration changes to opcache nor should they be overwritten when you make them there. There are some instances where you can edit files - especially in the event they don't have their own UI. One of the things I linked you to those threads for was the links within them but ultimately you can disable opcache per user in the .ini file - depending on the handler you're using you'd add the following in either the php.ini or .user.ini opcache.enable=00 -
Tried that already. I cleared the cache afterwards and it was still caching files on the account/domain I disabled it. I guess that means this won't work when using lsapi as the php handler (mod_lsapi to be specific)? Can you confirm that? If so, I believe I can 'sort of' achieve the same affect by adding that account's home directory to the opcache blacklist, but wanted to see if I can just flat out disable it first. Thanks for any info. 0 -
Hi @morrow95 I added it to a .user.ini yesterday and confirmed it works but for mod_lsapi i just tested added a php_flag in the .htaccess as follows and that was successful: php_flag opcache.enable Off
For example I have the following in my .htaccessphp_flag display_errors Off php_value max_execution_time 30 php_value max_input_time 60 php_value max_input_vars 1000 php_value memory_limit 32M php_value post_max_size 8M php_value session.gc_maxlifetime 1440 php_value session.save_path "/var/cpanel/php/sessions/ea-php72" php_value upload_max_filesize 2M php_flag zlib.output_compression Off php_flag opcache.enable Off0 -
Awesome - thank you Lauren! I didn't think to use htaccess for this. So I guess that means I can manipulate the opchache settings any way I want then for any accounts/folders/etc which is even better. I'll run some tests with this later today. Thanks! 0 -
Also good to note that if you're using CloudLinux's full version of mod_lsapi as opposed to our version you may be able to configure it to recognize .ini files using a Pre VirtualHost include Let me know if the .htaccess solution works for you though! 0 -
It seems to work fine. What is surprising to me is it seems like each account has its own opcache. If I look at the opcache stats they are different for each account (different memory usage, hit rate, keys, etc). I could see that becoming an issue if our server had a ton of accounts on it as it would use the default 128MB for each one after being enabled. 0 -
I'm glad to hear it's working out. The overhead of caching, in general, is something you definitely want to take into account. It makes things load faster but causing higher memory and resource consumption on the server in some cases, due of course to the cache. 0
Please sign in to leave a comment.
Comments
10 comments