Configuring Opcache across multiple accounts

hector_super

Member
Aug 4, 2016
17
1
3
Australia
cPanel Access Level
Root Administrator
Hi,

I have searched on Google and this forum with no luck, apologies if there's an answer to this already, I couldn't find it.

I just provisioned PHP 7 and 7.1 on our dedicated server which hosts several accounts.

Questions:

1. Should the opcache settings be done at a global level on WHM's INI Editor? Or should they be done at an account level separately?

2. Is it possible to allow/disallow specific accounts from using opcache?

3. If settings are done globally and allow anyone on the server, is the code cached separately in each account's directory or is it mixed? If the latter, are there any security issues I should be aware of?

4. If I run a GUI to monitor opcache, would I need one for PHP 7 and another one for PHP 7.1?


Many thanks
 

webhostuk

Well-Known Member
Sep 11, 2013
150
16
68
UK
cPanel Access Level
Website Owner
Twitter
From what I understand I think you wish to enable opcache per account.
To make things simple you need to first enable php-FPM for the account you wish to enable opcache , once php-FPM is on opcache will be on for that account.
This action can also be enabled globally.

For enabling php-FMP you need to do easyapache for particular version you select.

Once php-FPM Enabled on the server you can handle its status per account thought WHM itself , search for php-FPM in WHM and then enable disble status per domain.

For different versions of php you will have to independently enable opcache for that php Version.

Hope this helps.
 

hector_super

Member
Aug 4, 2016
17
1
3
Australia
cPanel Access Level
Root Administrator
Thanks Michael and @webhostuk

A few other questions about Opcache:

1. Are the global settings, global? Meaning, is the 32MB (or whatever value) to be shared across all users or each user gets 32MB? Where are the cached scripts stored in the server?

2. If I want to use a GUI such as github.com/PeeHaa/OpCacheGUI will it have to run from each user's directory or would I need a single global instance?

3. Likewise, would the GUI mentioned in # 2 include stats for opcache across different versions of PHP or would I need to run one separate GUI per each version of PHP that has opcache enabled?
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
1. Are the global settings, global? Meaning, is the 32MB (or whatever value) to be shared across all users or each user gets 32MB? Where are the cached scripts stored in the server?
The following URLs explain how Opcache works in more detail:

OpCache - understanding how the cache works, per user or per resource?
PHP Performance I: Everything You Need to Know About OpCode Caches

This thread offers some more details you may find helpful as well:

SOLVED - Zend OPcache and PHP-FPM

2. If I want to use a GUI such as github.com/PeeHaa/OpCacheGUI will it have to run from each user's directory or would I need a single global instance?
3. Likewise, would the GUI mentioned in # 2 include stats for opcache across different versions of PHP or would I need to run one separate GUI per each version of PHP that has opcache enabled?
I believe the following feature request covers how the existing setup with OPCache works (shared per each PHP version):

Zend Opcache User Interface for WHM / cPanel - (with separate cache's for each cpanel account)

Thank you.
 

hector_super

Member
Aug 4, 2016
17
1
3
Australia
cPanel Access Level
Root Administrator
Thanks @cPanelMichael

I have read the links you sent and the last one (Feature Request) mentions what I believe is my solution:

If you are prepared to pay, Litespeed can be confured to do this nativly.
Zend Opcache User Interface for WHM / cPanel - (with separate cache's for each cpanel account)

I run Litespeed. So to confirm: could I operate entirely separate opcaches, each per user, to avoid file collisions and one user peeking into the other's files etc? Is this something I should discuss with LS or do you have some recommendations / instructions how to do that? If I do it through Litespeed:

1. Would each user have their separate memory allocation for their caches?
2. Would a GUI (such as OpCacheGUI) run locally on each account without affecting others?
3. Would I be able to enable/disable opcache per account, even if they all used the same version of PHP?

Many thanks