Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to disable PHP-OPcache per user/site

Discussion in 'EasyApache' started by Derekn, Oct 17, 2017.

  1. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    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
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,792
    Likes Received:
    83
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Do not use PHP flags in .htaccess, instead create your own custom PHP.ini in the account you want and then define the parameters you need or disable it..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    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
     
  4. Muhammed Fasal

    Muhammed Fasal Active Member

    Joined:
    Aug 9, 2017
    Messages:
    39
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    I think you made a mistake on php.ini file, the correct directive should be opcache.enable=0, not Opcache_enable=0, please try to add below code on your php.ini file and check again.

     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    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
     
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    What PHP handler are you using?
     
  7. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi, i believe i am using CGI, system is php-fpm and php7.1
    Thank you for your help
     
  8. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,659
    Likes Received:
    76
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    Is it php-fpm or is it cgi? If it's CGI, is is suPHP or something else?
     
  9. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    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
     
  10. cPanelRyland

    cPanelRyland cPanel Technical Analyst
    Staff Member

    Joined:
    Oct 4, 2017
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    78
    Location:
    Houston, 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.
     
  11. NilsNoldus

    NilsNoldus Registered

    Joined:
    Sep 23, 2017
    Messages:
    1
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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.
     
    Derekn likes this.
  12. Derekn

    Derekn Member

    Joined:
    Mar 25, 2017
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    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
     
    #12 Derekn, Oct 19, 2017
    Last edited: Oct 19, 2017
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,794
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice