PHP-FPM and excluding files from opcache

APatchworkBoy

Active Member
Feb 26, 2018
27
7
3
West Yorkshire, UK
cPanel Access Level
Root Administrator
Afternoon folks - in latest stable, where would be the correct spot to place this for EA4 php7.1 FPM?

Code:
opcache.blacklist_filename=/path/to/opcache-blacklist.txt
(Referencing: How to disable PHP OPCache for certain directories | en.code-bude.net)

Am looking at /opt/cpanel/ea-php71/root/etc/php-fpm.d/{domain}.conf but the file states that it's generated and to use WHM Interface.

Or is it as simple as adding the paths to the existing blacklist in /opt/cpanel/ea-php71/root/etc/php.d/opcache-default.blacklist and restarting php-fpm? (Do changes in php.d/ also impact php-fpm.d/ ?)
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @APatchworkBoy,

The OPCache extension uses it's own .ini file at:

/opt/cpanel/ea-php71/root/etc/php.d/10-opcache.ini

This is the file you should edit if you want to modify the default global OPcache PHP settings for PHP 7.1. Upon making the changes, ensure to run the following commands:

Code:
/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_httpd
The following resource is also available if you'd like to read more about managing php.ini directives with PHP-FPM on a per-account basis or exclusively for domains using PHP-FPM:

Tutorial - Managing php.ini directives with PHP-FPM

Thank you.
 
  • Like
Reactions: APatchworkBoy

ronaldst

Well-Known Member
Feb 22, 2016
85
16
8
Norway
cPanel Access Level
Root Administrator
I've run into a problem with OPCache for one of my users (running WordPress). He uses a well-known (and reputable) plugin which has stopped working properly after OPCache was turned on.

I need to activate some sort of OPCache blacklist for his account and/or domain.

Server is running Apache, PHP-FPM & OPcache.

How do I best approach this?

Can a user edit his PHP-configuration in cPanel (or .htaccess) and achieve this by himself?

Do I need to configure a blacklist in the domain .yaml-file for the domain?

Or is the only option to edit the global configuration for OPCache in ea-php7x/root/etc/php.d/10-opcache.ini?

I would love if someone would be kind and provide some best practice insights on this and an example.


Thank you.
 

ronaldst

Well-Known Member
Feb 22, 2016
85
16
8
Norway
cPanel Access Level
Root Administrator
Thank you @cPanelMichael

I'm aware how to make a global blacklist in OPCache (as described in this post).

However, what I'm asking is if it is possible to add a blacklist in OPCache for a specific user and/or domain. Is this something the user can manage by himself from cPanel?

I want to avoid adjusting the global configuration for every user with specific needs, if possible.

My apologies if this wasn't clear in my first post.

Can a regular (cPanel) user manage his own OPCache blacklist, either by using the PHP-configuration options provided in cPanel or by .htaccess? If so, how?

If not, can this be done by (me) editing/adding a blacklist in the .yaml-file for this specific user/domain?

.. or should I go ahead and edit the global configuration for OPCache (as this is the only solution)?

Thank you.
 
Last edited:

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter