Missing MySQL extension - MultiPHP

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
I am, perhaps, on a fool's errand. My wish is to run both PHP 5.x and PHP 7.2 on the same VPS. I don't want to make a wholesale change to all accounts because I need to be able to test compatibility of custom WordPress code and installed plugins for all sites with the latest version of PHP first.

I have enabled the MultiPHP Manager feature using EasyApache4. I've also added a handler for PHP 7.2 to the installation. I switched one account/cPanel to the PHP 7.2 handler and, when I tried to access the site, I received this error:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress
I have found two other threads that are peripherally or directly related to this error:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
SOLVED - PHP installation appears to be missing the MySQL extension

Here is the phpinfo from the account for which I've activated PHP 7.2:
- Removed -

Here is the phpinfo for an account running the server default version, PHP 5.6:
- Removed -

What isn't clear from the provided solutions is whether I can run multiple instances of MySQL on the same server and, if not, what would be required to make this happen.

Any guidance on this inquiry will be greatly appreciated.
 
Last edited by a moderator:

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
I used EasyApache4 to add the mysqlnd php extension to php 7.2.

I have enabled the MultiPHP Manager feature using EasyApache4. I've also added a handler for PHP 7.2 to the installation. I switched one account/cPanel to the PHP 7.2 handler.

I have restarted Apache Services.

When I review phpinfo, I can see that it is using PHP Version 7.2.10 but when I review phpMyAdmin for that cPanel, it is still using PHP version: 5.6.30.

It appears that there is more to this than I'm able to find information about on the web at large. Can anyone here provide direction or instruction on how I can complete this mission?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
Hi @marjwyatt

In addition to @sparek-3's question I'd like to know where in phpmyadmin you're seeing it's running php 5.6 as I can confirm that the phpinfo pages reflect php 7.2 and php 5.6 respectively (The links were removed but I am able to view the history)

That being said I can see the mysqlnd extension enabled on both and there should be no conflict. This is also not related to the version of MySQL you have installed.

Can you show me in phpmyadmin where it shows the incorrect php version? For example my phpadmin in the "Web Server" section says the following:
web_server.png

Thanks!
 

sparek-3

Well-Known Member
Aug 10, 2002
1,983
218
343
cPanel Access Level
Root Administrator
@cPanelLauren did the version of PHP that cPanel (the backend cPanel... port 2083) change to 7.2 in the Edge builds?

I can confirm that my cPanel, cPanel version 11.74.0.8, is still showing PHP 5.6.30.

Now, I don't have a problem with that and I understand that the PHP version for the backend cPanel (port 2083) is completely different from the front facing PHP version (ports 80 and 443).
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
@cPanelLauren did the version of PHP that cPanel (the backend cPanel... port 2083) change to 7.2 in the Edge builds?

I can confirm that my cPanel, cPanel version 11.74.0.8, is still showing PHP 5.6.30.

Now, I don't have a problem with that and I understand that the PHP version for the backend cPanel (port 2083) is completely different from the front facing PHP version (ports 80 and 443).
You know what! It sure did! Updating the internal PHP was a big part of v76. PHPMyAdmin is reflecting cPanel's internal PHP version, not your PHP version @marjwyatt

From my v74 test server:
74_phpmyadmin.png

This has no impact on your sites though, all cPanel services including PHPMyAdmin run off of cPanel's internal PHP version as eluded to by @sparek-3

Thanks!
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
@sparek-3
The WordPress version on that installation is 4.9.7, although I'm not sure why that is important to know. I have that same version running locally on Xampp with PHP 7.2 (VC15).

@cPanelLauren
I've uploaded an image of the webserver via phpMyAdmin on the cPanel where I have enabled PHP 7.2.

I've also uploaded a couple more images showing the MultiPHP settings. On the account cPanel screenshot, there appears to be another "clue" there related to inherit. Yet, when I review MultiPHP settings for that same account in WHM, I do not see that this domain is set to inherit.
2018-09-25_literalgal.jpg
2018-09-25_literalgal-cpanel-multiphp.jpg 2018-09-25_literalgal-whm-multiphp.jpg
 

sparek-3

Well-Known Member
Aug 10, 2002
1,983
218
343
cPanel Access Level
Root Administrator
PHP cut out the mysql functions in PHP 7.0 (or PHP 7.1? one of those) and older scripts (maybe WordPress before 4.7?) still relied on those older mysql functions. That's why I asked.

Maybe an old plugin?

Or may just be unrelated completely. But that was the rabbit hole I was chasing.
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
The confusion here is, as I mentioned in my last post, within PHPMyAdmin you're seeing cPanel's internal PHP version.


Secondly, none of those domains listed is set to inherit, default/system php is 5.6 per that screenshot if the domains were set to inherit they would not explicitly be assigned PHP 7.2. The information about inherit is there is to let you know what the system/default PHP version is and how it's set.

Again, the two are unrelated. The system/default version of PHP, your site's PHP version and cPanel's Internal PHP version.
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
PHP cut out the mysql functions in PHP 7.0 (or PHP 7.1? one of those) and older scripts (maybe WordPress before 4.7?) still relied on those older mysql functions. That's why I asked.

Maybe an old plugin?

Or may just be unrelated completely. But that was the rabbit hole I was chasing.
This has become somewhat of a rabbit hole chase, I do admit.

I intentionally chose to experiment on a WordPress installation that was "vanilla" in nature. This site is only one version behind the latest release and has very few plugins installed. It is using the default theme, too.

The conflict between cPanel's interpretation of "inherited" versus what I'm seeing related to that domain/account in WHM seems to be the rabbit hole to chase. I know that I'm missing something important.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
@marjwyatt

I'm not sure I understand the confusion remaining about inherited php. As I stated before none of your domains is using inherited php and the information under "system PHP" has nothing to do with your php version or the php version being shown in PHPMyAdmin.

In fact everything seems to be displaying normally at this point. Per the screenshot both those domains are running PHP 7.2 none of them are using the system default of php 5.6 nor are they inheriting their verision of PHP.
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
The confusion here is, as I mentioned in my last post, within PHPMyAdmin you're seeing cPanel's internal PHP version.


Secondly, none of those domains listed is set to inherit, default/system php is 5.6 per that screenshot if the domains were set to inherit they would not explicitly be assigned PHP 7.2. The information about inherit is there is to let you know what the system/default PHP version is and how it's set.

Again, the two are unrelated. The system/default version of PHP, your site's PHP version and cPanel's Internal PHP version.
Okay. I expected to see something akin to what I'm seeing on my local installation of Xampp running VC15.
2018-09-25_xampp-VC15-phpMyAdmin.jpg

What do I need to do to see/verify that I am actually using PHP 7.2 on my VPS account where I have activated it?
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
@marjwyatt

I'm not sure I understand the confusion remaining about inherited php. As I stated before none of your domains is using inherited php and the information under "system PHP" has nothing to do with your php version or the php version being shown in PHPMyAdmin.

In fact everything seems to be displaying normally at this point. Per the screenshot both those domains are running PHP 7.2 none of them are using the system default of php 5.6 nor are they inheriting their verision of PHP.
I guess my "gut" is telling me that I need to see the database in a second instance of mySQL? I don't know how to frame the question. Locally, on Xampp, I can only run one version at a time because of the port. Do I need to create a MySQL instance on a second port on my VPS to run them side-by-side?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
Okay. I expected to see something akin to what I'm seeing on my local installation of Xampp running VC15.
View attachment 54613

What do I need to do to see/verify that I am actually using PHP 7.2 on my VPS account where I have activated it?
The phpinfo page is what you'd use to be certain.
As far as your installation of Xampp configuration differences there cause it to display differently. cPanel runs all cPanel related services including phpmyadmin over specific ports using its own internal PHP - it really has little to do with *your* php version.

I guess my "gut" is telling me that I need to see the database in a second instance of mySQL? I don't know how to frame the question. Locally, on Xampp, I can only run one version at a time because of the port. Do I need to create a MySQL instance on a second port on my VPS to run them side-by-side?
I'm not really understanding what you're trying to accomplish with this do you think it would be possible to clarify what you mean? Why do you feel like you need a second MySQL instance, or more so what will that prove in this instance?

Thanks!
 

sparek-3

Well-Known Member
Aug 10, 2002
1,983
218
343
cPanel Access Level
Root Administrator
Maybe you've already done this, since the links were removed, I'm not able to see it.

You are trying to access a WordPress script on example1.tld correct?

When you go to http://example1.tld that's when you get the - Your PHP installation appears to be missing the MySQL extension which is required by WordPress - correct?

Put a phpinfo in that account's public_html folder

<?php phpinfo(); ?>

Save it as phpinfo.php

Now go to http://example1.tld/phpinfo.php

What version is it showing?

Do you see a section labeled mysqlnd?

Do you see a section labeled mysqli?
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
@cPanelLauren
Well, I guess that on Xampp, the only way to run PHP 5.6 and PHP 7.2 side-by-side was to change MySQL ports for one installation. Maybe I need to unlearn what I learned from Xampp.

What I'm trying to avoid is a wholesale update to PHP 7.2 when PHP 5.6 becomes obsolete at the end of this year. Are you trying to tell me that enabling PHP 7.2 distinctly on various accounts that it can access a database using another version of PHP?

@sparek-3
When you go to http://example1.tld that's when you get the - Your PHP installation appears to be missing the MySQL extension which is required by WordPress - correct?
No. I solved that problem this morning when I added mysqlnd to the configuration.

Put a phpinfo in that account's public_html folder
I had already uploaded this file. Following are the answers to your questions.

What version is it showing?
PHP Version 7.2.10

Do you see a section labeled mysqlnd?
Yes. Here's the screenshot.
2018-09-25_literalgal-mysqlnd72.jpg

Do you see a section labeled mysqli?
Yes. Here's the screenshot.
2018-09-25_literalgal-mysqlnd72.jpg 2018-09-25_literalgal-mysqli72.jpg
 

sparek-3

Well-Known Member
Aug 10, 2002
1,983
218
343
cPanel Access Level
Root Administrator
OK, I must've overlooked where this was resolved.

No, you don't need separate MySQL (or the more generic name, database services) for each version of PHP.

Your database service is just a service.

PHP interfaces with that service if you tell it to.

It has to know what hostname/IP (which if it's running on the same server, you use localhost or 127.0.0.1) and a port (which defaults to port 3306). That's how the TCP stack works - unique IP address and port per service.

Now if you don't have the correct extensions installed for each version of PHP, then PHP may not know how to interface with the database service.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
The information provided by @sparek-3 is correct and with that knowledge I think it might be fair to say at this juncture the issue is resolved. @marjwyatt can you confirm that the initial issue is resolved?

Thanks!
 

marjwyatt

Well-Known Member
Jun 23, 2014
48
5
58
cPanel Access Level
Reseller Owner
@cPanelLauren - I had already done most of the things that @sparek-3 was recommending before he chimed in on this thread but I certainly do appreciate their interest in wanting to help.

I mulled over my confusion after your last reply, @cPanelLauren, and finally figured out what you were trying to convey to me. I think that I encapsulated it in my comment above:
Well, I guess that on Xampp, the only way to run PHP 5.6 and PHP 7.2 side-by-side was to change MySQL ports for one installation. Maybe I need to unlearn what I learned from Xampp.
This understanding was augmented by reviewing WordPress minimum requirements which listed at their site and noted that their MySQL version was the same as what I was seeing.

PHP version 7.2 or greater.
MySQL version 5.6 or greater OR MariaDB version 10.0 or greater.
HTTPS support

I have successfully activated PHP 7.2.10 at two WordPress sites, so far. One with and one without PHP-FPM. I have a question about that further down.

I do have a couple more questions about configuring PHP on EasyApache4 if you will indulge me.

I believed it would be prudent to include all PHP extensions that are activated for PHP 5.6. I hit a little speed bump. When I tried to activate php72-php, I got the following response which causes me to not proceed.

The following conflicts are installed on this machine. They will be removed as part of this package selection: php56-php

The following requirements are not installed on this machine. They will be added as part of this package selection: php72-php
I understand that this component (php DSO) is an older PHP handler that runs PHP as an Apache module. I suppose I shouldn't worry about it because I do have a WordPress site running without that but it sort of begs the question about what is the preferred PHP handler to implement?

The other question is related to PHP-FPM. The MultiPHP Screen of WHM cautions against implementing it server wide for fear it will consume too much server memory. Is it true that, if I am not using PHP-FPM to activate PHP 7.2, that I have to encode the handler into the .htaccess file?

I'm sorry to be such a burden in my questions to you, @cPanelLauren. As always, I appreciate your assistance and patience.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,304
1,252
313
Houston
Hi @marjwyatt

You are not a burden and we are always more than happy to help answer questions!

I understand that this component (php DSO) is an older PHP handler that runs PHP as an Apache module. I suppose I shouldn't worry about it because I do have a WordPress site running without that but it sort of begs the question about what is the preferred PHP handler to implement?
You can only have one php version running DSO so that would be why you had an issue when attempting to install it for another version of PHP. What the preferred handler depends on what you want. Most PHP handlers have a set of benefits/pitfalls. I will say that handlers do not apply to php-fpm and by default we roll out servers with CGI and mod_ruid2. You can read about the handlers here PHP Handlers - EasyApache 4 - cPanel Documentation which could be helpful.

The other question is related to PHP-FPM. The MultiPHP Screen of WHM cautions against implementing it server wide for fear it will consume too much server memory.
It can consume a large amount of memory I believe 16mb per VirtualHost that has it applied for startup but if you have enough memory you shouldn't really need to worry about this

Is it true that, if I am not using PHP-FPM to activate PHP 7.2, that I have to encode the handler into the .htaccess file?
The .htaccess includes the handler automatically in an AddHandler directive where did you hear this?

Thanks!