"PHP module mysql is required .... could not find global php.ini file" using Wordpress Install Script

When using the Wordpress install script I get the message:

“PHP module mysql is required … could not find global php.ini file”

Here are details:

  • I use Create Virtual Server to create a new server. This seems to work fine.
  • I then use Install Scripts to select and install Wordpress (default - 4.9.5) and when I click “Install” I get that message.
  • The host came with PHP 5.5.9 installed, and i installed PHP 7.0.30 manually. (Other WP sites on this server wind up using PHP 5.5.9)
  • I’m using Virtualmin 6.03, Webmin 1.881 on a Ubuntu 14.04 VPS.
  • Using the manual Wordpress “5 minute” install with another site on this server works fine.
  • Software Versions shows:

    Operating system Ubuntu Linux 14.04.3
    Perl version 5.018002
    Path to Perl /usr/bin/perl
    BIND version 9.9
    Postfix version 2.7.0
    Mail injection command /usr/lib/sendmail -t
    Apache version 2.4.7
    PHP versions 5.5.9, 7.0.30
    Logrotate version 3.8.7
    MySQL version 5.5.60-0ubuntu0.14.04.1

Thoughts on debugging this? What other information could I provide? Thanks.

Hi, I have the same error message! Any update on this? Maybe because I installed PHP 7.2 on my Ubuntu 16.04 machine? I has 7.0 installed by default. Maybe because of this it can not find the php.ini file?

Operating system Ubuntu Linux 16.04.4
Webmin version 1.883
Usermin version 1.741
Virtualmin version 6.03
Kernel and CPU Linux 4.4.0-119-generic on x86_64
Apache version 2.4.18
PHP versions 7.2.5
MySQL version 5.7.22-0ubuntu0.16.04.1

Did you guys check what modules are loaded to actually see if mysql is missing or not?

Thanks for this response. Sorry for the newbie question (I’m new to WP admin - I’m very comfortable with SSH’ing into hosts…)

What’s a good way to check if mysql is missing/present? Thanks.

One more thought: I have successfully installed Wordpress several times on the very same host by downloading the WP install file and using the famous 5-minute procedure… It works without complaint: what’s different between the standard WP install process and the Virtualmin Install Scripts… Thanks!

Hello, I have multiple Wordpress/WooCommerce sites running on my server, no issues. All is fine. Just most of the script do not install. Actually the squirrelmail script did install. But, the others (Wordpress, SquirrelMail…) do not install. I tried installing different versions, and tried installing while logged in as main administrator and as a virtual server account, but all show the same error message. Are there any log files I can send you to help? I am really very, very impressed with Webmin/Virtualmin! I am using it on my self managed servers, and it is great!

To check loaded PHP modules connect with SSH and run php -m and if you need to do the same with Apache then use apache2ctl -M for Ubuntu or for Centos apachectl -M (apachectl -M | sort for the list in alphabetical order).

Thanks for the tip. I have placed the output of the php -m and apache2ctl -M commands on pastebin at https://pastebin.com/aZSw1Vkb What would be my next step(s)? Thanks.

Update: I added the list of php.ini files in /etc/ to the pastebin page

Update: I added info from phpinfo() call to the pastebin at https://pastebin.com/aZSw1Vkb

Based on your output i dont see anything missing in PHP modules. You should check your php.ini files in /etc and /home and see if they are missing or with wrong settings. But based on the error message i would suspect something is wrong with php.ini located in /etc.

Ahah! I think you’ve put your finger on it. The pastebin shows there are several php.ini files nested in /etc - /etc/php5/cli/php.ini /etc/php5/apache2/php.ini /etc/php/7.0/cli/php.ini /etc/php/7.0/apache2/php.ini

BUT… /home/myuserid/etc is empty!

I suspect I could simply copy one of the php.ini files from /etc, but which one?

(And if I could further impose on your knowledge and generosity, how do I tell the WP install to use php 7.0, not php5?) Thanks!

I suspect I could simply copy one of the php.ini files from /etc, but which one?

My knowledge about Ubuntu/Debian is really low but if i remember right /etc/php5/apache2/php.ini and /etc/php/7.0/apache2/php.ini are the “right” one, which one depends what PHP version you are going to use.

And if I could further impose on your knowledge and generosity, how do I tell the WP install to use php 7.0, not php5?

Virtualmin -> Virtual server -> Server configuration -> PHP versions - Here you should find all installed PHP versions, pick one you want and it should work.

Hi, I am the other guy with the same problem. I placed the output of the php -m and apache2ctl -M commands here:
https://pastebin.com/Lw4HdiDQ

I am running PHP in FPM mode. Could this be the problem? I have two php.ini files in my home directory, in the folders “myhome/etc/php.ini” and “myhome/etc/php7.2/php.ini”

I suspect both of you could have some miss-configuration going on inside some of the php.ini files. If you are on Ubuntu and using FPM you should have php.ini inside /etc/php/“version number”/fpm/php.ini so maybe is worth to check that file.

To be honest i never encounter something similar with Centos and multiple PHP versions and as i previously said i’m not really “at home” with Ubuntu/Debian, so maybe if you guys try to dig more info it would help you even more. There was one guy on this forum with good knowledge about Ubuntu/Debian but looks like he isnt active anymore.

P.S. Its worth to check Apache/PHP files and their permissions (especially ones in /home) maybe some php.ini files dont have correct ownership.

Hi, thanks again for all the help! I got mine to work by changing the PHP module to mod_php. If I change it to FPM it does not work, and shows the reported error. But, everything else works when in FPM mode. I have a wordpress/woocommerce site with many plugins, and lots of other stuff all working fine with FPM. Just the install scrips does not work.

Just the install scrips does not work.

When it comes to Wordpress and problem with installing it or the addons usually is the problem with file ownership but this isnt 100% so it could be something else.
Who is the owner of php.ini files inside /home? It should be the virtual server admin, e.g. if you have /home/nicedomain/… then the owner of php.ini files should be nicedomain:nicedomain.

If I change it to FPM

Did you try to switch to fcgi?

Hi Diabolico - I really appreciate the effort you’ve put into solving this problem. I’m not sure that it’s worth our time to struggle further because there’s a clear workaround. I need to get a site up, and will use the standard Wordpress installer from the command line.

But I have created a new topic in the Virtualmin forum (https://www.virtualmin.com/node/57507) that documents the fact that the Install Scripts don’t work “out of the box”. Hopefully that will attract the attention of someone who can investigate.

Thanks again - you’ve done me a great service.

Rich Brown

Well if there is no some obvious solution maybe its a bug and it would be good if you guys report that under “Issues”.

We have found that the having FCGI being used instead of FPM can affect this.
Server configurations > Website Options
Make sure - Run CGI scripts as domain owner.
Then make sure that the PHP execution mode is set at : FCGID.

You can then revert back to FPM if you wish to.