Several PHP settings do not reflect on my WordPress installation

SYSTEM INFORMATION
OS type and version Ubuntu 20.04 LTS
Webmin version 2.010
Virtualmin version 7
Related packages SUGGESTED

In Virtualmin, for one host I set some PHP variables (upload_max_filesize=500M and a few others), PHP script execution mode (FPM), and PHP version (7.4.33) from Server Configuration → PHP Options

Yet, when I check my WordPress site health info I find different settings. Just for example, max upload file size is 2M, as well as other variables. One notable thing is that it shows that Wordpress folder is not writable, even though it’s permission is 750, and the process (supposedly) run with the permissions of the same user. When I chmod g+w it’s writable. So obviously the server runs under a different user

What could be the problem? How can I fix it?

Did you restart the services after you made the changes?

At a minimum, you have to

  • Manually make changes from defaults in the PHP configuration(s) ( Webmin > Tools > PHP Configuration ).

  • Restart each service and enable the one(s) you want to start at boot ( Webmin > System > Bootup and Shutdown ).

That’s usually enough, but in some cases you’ll also have to specify the default CLI version for the system. I don’t know how to do that in Ubuntu, so I will defer on that.

Richard

I have no idea what you mean by that; in Virtualmin → Limits and Validation → Validate Virtual Servers, the Fix Permissions tab will set / reset the correct user and permissions required per virtual server. If your app complains (WordPress probably won’t) then you can further tweak the permissions. There should never be need for you to change the user.

Running the server validation shows that it’s all good
Now I noticed something. I tried <?php echo exec('whoami')/ ?>, which oddly outputed www-data rather than the designated user, which is set in Services->Configure Website->Users & Groups. How comes? And how should I fix that?

You’ve installed mod_php. You should not have.

Isn’t it disabled here?

Now I found in phpinfo that it loads the global php info rather than the virtual server’s one. How do I fix that?

I believe that’s part of the chaos that mod php creates and why it should never, ever be installed.

I only know of two ways to fix it, so you might want to wait and see if someone else weighs in with a better solution.

Option 1: obliterate the server and start over.

Option 2: go to your file manager to top level, search for php.ini and change the values in every single one of them. You’ll probably have 6 or 8 different ones at least, located in different places. Change the values to what you want in all of them, then restart your services.

The same answer. You installed mod_php, and should not have.

Uninstall mod_php. It is usually in a package called just php or phpVERSION-php.

There is no reason to have mod_php installed. Literally none. Just uninstall it and don’t install it again, and this thread stops being complicated.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.