/opt/cpanel/ea-phpXX/root/etc/php.ini

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
931
21
168
Can someone please confirm that if I want to make global changes to the various PHP versions php.ini files - all I have to do is edit the files in

/opt/cpanel/ea-phpxx/root/etc/php.ini

And that there is no other process involved?

In the past we have attempted to copy ini files between servers to make the server setup process easier - but this has previously resulted in the ini files being reset to the cpanel provided defaults. The editable directives that can be changed in WHM were not retained. This leads me to believe there is a process involved that stores these directives somewhere and re-adds them if there are updates to the default files.

Would like clarification please.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
Hello,

That is where changes should be made, though I'd recommend doing this in the MultiPHP INI interface - if you're going to modify through the CLI using a script I'd suggest using the whmapi1:
.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
931
21
168
Thanks Lauren, can you explain why you would recommend making all those changes via the WHM interface? It's certainly not much fun making individual changes to several different PHP versions over 50 servers that way.

I think using a script or the API is overkill when all you need to do is copy the files down.

We have been provisioning all servers with the same EA4 profile, setting up the php.ini files correctly on one server via WHM and then copying them to the other servers. Would you not recommend we do it this way? it seems like the simplest and quickest way to me.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
You can modify it directly, but the recommendation to use the UI or the API is to ensure that it's not overwritten by something else. I am not 100% sure what would overwrite changes to the php.ini file there but you mentioned that it had been and to ensure it doesn't happen the API or the UI is the best method.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
931
21
168
When the issue happened a few years ago I raised a support ticket and there was mention of some other files involved in the process. Unfortunately that support ticket no longer seems to exist.

There is no way we can make changes to each version of PHP on every server via the interface. It would take too long.

If it's not safe to copy the ini files, I'd be happy as a last resort to use the command line API functions like the example...

Code:
whmapi1 php_ini_set_directives directive-1=allow_url_fopen%3A0 directive-2=upload_max_filesize%3A4M version=ea-php70
What's the deal with having to use URI encode values? Makes it more complicated than it needs to be.

Anyway... My original question is still unanswered Lauren. Thanks for your reply but you haven't given me a conclusive answer. You said that those files can be edited but it isn't recommened in case some other process changes them back again - but you can't tell me what other process might be involved, so really you're not sure.

Obviously I'd much rather just copy the ini files over - so I need to know whether or not the values will actually stick if we do that.

Would you be able to find out for me?
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
931
21
168
So I tested this on a server that didn't have PHP version 7.3 installed. I ran EA4 and installed 7.3 - then uploaded a php.ini file to /opt/cpanel/ea-php73/root/etc/php.ini with our preferred settings. I did not use WHM or the cli. I restarted Apache in case that would be required

I checked the settings from within WHM and found them to be correct.

24 hours later - the ini file has been reset to the default settings as if it had just been installed.

I need to know what process is involved here and if there is a way of forcing the default settings on a number of servers. it is painfully slow and frustrating to configure each server individually.

Can you help me out Lauren or should I raise a support request?