How to disable PHP-OPcache per user/site

Derekn

Member
Mar 25, 2017
16
0
1
cPanel Access Level
Website Owner
Hi,
I just used EasyApache to enable PHP-OPcache (using php 7.1) to optimize my Magento 2 website performance. However, it created error for my other websites on same hosting; my other website display blank page or keep redirect back to installation page. I checked, there is some kind of heavy cache which causing this problem and I am thinking because of OPcache that i just enabled
So can anyone show me how to enable/disable PHP-OPcache per user/website? I tried to search online but i could not find working solution ( for example, i tried to add "
php_flag opcache.enable Off" to .htaccess file from user root directories...)

Thank you so much
 

Derekn

Member
Mar 25, 2017
16
0
1
cPanel Access Level
Website Owner
Hi, thank you for your help. I tried that also by adding Opcache_enable=0 to php ini in my website user account cpanel, but it didnt work. I ran phpinfo, OPcache is still on.
So can you suggest more detail please? Im not really a developer .

Thank you so much
 

Derekn

Member
Mar 25, 2017
16
0
1
cPanel Access Level
Website Owner
Hi,
Yes, opcache.enable=0 was what i meant, sorry, but i just tried again. It didnot work, phpinfo still showing on for both Local and master value
 

Derekn

Member
Mar 25, 2017
16
0
1
cPanel Access Level
Website Owner
Hi, i am not sure about this, i clicked php manager --> php handler and it display only cgi, no other information. Above all php handler page it said "PHP Handlers do not apply to PHP-FPM".
If this is not the right section to look, can you show me where to look at WHM? I am not a developer:(
Thank you so much, and im really appreciated
 

cPanelRyland

cPanel Technical Analyst
Staff member
Oct 4, 2017
23
2
78
TX
cPanel Access Level
Root Administrator
Hello,

You can see whether PHP-FPM is enabled for the system via MultiPHP Manager module within WHM (I've included mine below):

"Turn on/off PHP-FPM for all accounts.
System PHP-FPM Status: Off"

Additionally you can see if PHP-FPM is enabled on a per domain basis by checking the domains within the MultiPHP Manager.

I have included our documentation regarding PHP-FPM and EasyApache 4 below if PHP-FPM is indeed in use:

PHP-FPM and EasyApache 4 - Documentation - cPanel Documentation

Please review the above and let us know if you have any questions as we are happy to help.
 

NilsNoldus

Registered
Sep 23, 2017
1
1
3
Norway
cPanel Access Level
Root Administrator
I think with php-fpm you need a local ".user.ini" file in the users home directory, NOT php.ini

I just tried to put opcache.enable=0 in the .user.ini for one of my sites and it switched off opcache for that user.
 
  • Like
Reactions: Derekn

Derekn

Member
Mar 25, 2017
16
0
1
cPanel Access Level
Website Owner
Yes, it worked @NilsNoldus (but i have to put user.ini file at public_html directory, NOT home directory).
My website is back on after Opcache is disable, but opcache.enable_cli is still on, im not sure about this and what it does?

@cPanelRyland,
so if I turn of php-fpm for that user/website, opcache will turn off automatically?


Thank you so much guys;), im really appreciated
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

With PHP-FPM, you have to manually edit the PHP-FPM configuration for the domain name to update the php.ini values:

MultiPHP INI Editor Values Not Saved for PHP-FPM Sites

Outside of PHP-FPM, it's advised to use the MultiPHP INI Editor within cPanel to make changes to your PHP configuration values.

Thank you.