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!

OPcache "up and running" but doesn't cache any scripts

Discussion in 'EasyApache' started by Jim Ratliff, Jan 21, 2018.

Tags:
  1. Jim Ratliff

    Jim Ratliff Member

    Joined:
    Jan 1, 2018
    Messages:
    18
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Oakland CA
    cPanel Access Level:
    Root Administrator
    I installed and enabled OPcache (EasyApache 4, FastCGI, non-shared VPS) using WHM»Software»Easy Apache 4»All PHP Options + OpCache.

    My sites run PHP 5.6.33 (ea-php56).

    phpinfo() confirms that "Opcode caching" is "Up and Running".

    I also monitor OPcache using opcache-gui-2.4.0. It tells me:
    • number of cached files: 1
    • number of hits: 0
    • number of misses: 1
    • number of blacklist misses: 0
    Specifically, the 1 cached file (that opcache-gui lists in the "File usage" tab) is the opcache-gui script itself. I.e., it's not caching any of the actual substantive scripts that are executing. (These are a combination of WordPress, MediaWiki, and TikiWIki sites.)

    Question: Why is OPcache not caching any of the PHP scripts that are executed?

    Here are the lines that I added to php.ini via WHM»MultiPHP INI Editor (targeted at ea-php56):
    PHP:
    opcache.memory_consumption=64
    opcache
    .interned_strings_buffer=4
    opcache
    .max_accelerated_files=7963
    opcache
    .revalidate_freq=600
    opcache
    .fast_shutdown=0
    opcache
    .enable_cli=1
    opcache
    .enable=1
    [Side note: I did not add the following to php.ini:
    PHP:
    zend_extension=/opt/cpanel/ea-php56/root/usr/lib64/php/modules/opcache.so
    even though I thought I was supposed to. (When I did, it crashed the whole site with a 500 Internal Server Error.)]

    I'm also attaching a pdf of:
    • phpinfo(), part 1, showing the first page of the output
    • phpinfo(), part 2, showing the OPcache part of the output
    • the "Overview" tab of the output from opcache-gui script.
    I'd appreciate hearing ideas of what to do next, what additional information I could provide that might help the diagnosis, etc.

    Server Version: Apache/2.4.29 (cPanel) OpenSSL/1.0.2n mod_bwlimited/1.4
    Server MPM: worker

    Thanks!
    Jim
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Jim Ratliff

    Jim Ratliff Member

    Joined:
    Jan 1, 2018
    Messages:
    18
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Oakland CA
    cPanel Access Level:
    Root Administrator
    Thanks, Michael! I had not enabled PHP-FPM for any of my accounts.

    Taking your implicit suggestion, I enabled PHP-FPM on all of my accounts and OPcache started working like it should (caching thousands of files, using its memory, etc.)

    Even with all that I had already read (including three of your links), I had never seen anyone say that PHP-FPM is a prerequisite for OPcache. Is that the case?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's not required, but Opcode caching programs are not compatible with the suPHP or CGI PHP handlers. The caching program either does not function, or functions incorrectly when using those handlers. Thus, you'd generally want to use either DSO or PHP-FPM. This is documented at:

    PHP Options - EasyApache 4 - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Jim Ratliff

    Jim Ratliff Member

    Joined:
    Jan 1, 2018
    Messages:
    18
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Oakland CA
    cPanel Access Level:
    Root Administrator
    Thanks, Michael! I see (and had seen before) that "Opcode caching programs are not compatible with the suPHP or CGI PHP handlers. The caching program either does not function, or functions incorrectly." But I thought that Fast-CGI wasn't implicated (as being distinct from vanilla CGI). For example in:
    PHP Extension: OPCache - EasyApache - cPanel Documentation
    it says:
    And I had thought that "fcgi" was synonymous with Fast-CGI. (Perhaps that was my error. Although if you search for "fcgi" on Wikipedia, it sends you to FastCGI.)

    In any case, whatever terminological confusions I might have, you've steered me where I needed to go to get OPcache up and running and actually caching files. My load times are better.

    Next step is to tune the parameters, where I've learned I can't reliably use MultiPHP INI Editor to do that. (Except, puzzlingling for the "opcache.revalidate_freq" which does seem to be successfully changed when I use MultiPHP INI Editor.) But your other posts, e.g.,
    Enabling PHP-FPM in MultiPHP Manager
    will be helpful. I may have questions about that, but that'll be a separate topic.

    Feel free to close this thread. Thanks!
     
    cPanelMichael likes this.
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