Local Community

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Getting this message when I try to view my site.
I don’t know what to do with it. Any help please?

Anyone else having this issue. I managed to piece this together through lots of little bits of info spread across the internet. Why it’s not in one place in a simple to read way I do not know. It hasn’t worked for me, so I think I may have another issue to deal with too. Possibly need to update wordpress.

So. Go into Local. Change the environment to Custom and choose Apache, and PHP 7.2, and SQL 5.6.
Then right click your site name to open SSH.
Type in:
apt-get update
Press Enter and wait for it to do what it does.
When that is done type in:
apt-get install dialog
And then:
apt-get install php5-mysql
Press Enter, then Y, and wait for it to finish.
Finally:
service apache2 restart

Hi,

Can I confirm which version of Local you are working on and your OS version?

Also can you please provide your local-by-flywheel.log file?
Please see “How do I retrieve Local’s log file?” for instructions on how to do so.

Kind regards,
David

Hi,

Can I confirm which version of Local you are working on and your OS version?

Also can you please provide your local-by-flywheel.log file?
Please see “How do I retrieve Local’s log file?” for instructions on how to do so.

I’ve tried to recreate your issue by creating a new site on Local by Flywheel version 3.0.2 with a custom environment (Apache, PHP 7.2.0 & MySQL 5.6.34) and the WordPress installation and site is live and working correctly? You might also want to provide the phpinfo() screen as well for troubleshooting. You can do this by finding the PHP version information for the site in the Local
by Flywheel dashboard and clicking on the small circle icon with the letter ‘i’.

Kind regards,
David

I’m using Local 3.0.3 on a Windows 10 laptop.

I’ve been fiddling with settings to try and fix the problems. I found that not having Wordpress up to date was an issue, so I manually copied those files in, but then the site was giving hundreds of errors. I fixed most by dropping the PHP version from 7 to 5.6.
I went into wp-config.php and changed ‘WP_DEBUG’ to false.
And I found the code below to add to the PHP file which seemed to help.
Now when I try to view the site, I see no errors appear, but there is only a white blank screen. No content at all. Same with Admin.
If I set WP_DEBUG to true I see this error: Notice: wp_register_script was called <strong>incorrectly</strong>. Scripts and styles should not be registered or enqueued until the <code>wp_enqueue_scripts</code>, <code>admin_enqueue_scripts</code>, or <code>login_enqueue_scripts</code> hooks. Please see <a href=“https://codex.wordpress.org/Debugging_in_WordPress”>Debugging in WordPress</a> for more information. (This message was added in version 3.3.0.) in /app/public/wp-includes/functions.php on line 4231


diff --git a/includes/destinations.email.inc b/includes/destinations.email.inc
index c7d426d…70f46e7 100644
— a/includes/destinations.email.inc
+++ b/includes/destinations.email.inc
@@ -93,7 +93,7 @@ class mime_mail {
var $subject;
var $body;

  • function mime_mail() {
  • function __construct() {
    $this->parts = array();
    $this->to = “”;
    $this->from = “”;
    diff --git a/includes/files.inc b/includes/files.inc
    index 8931189…c1f374d 100644
    — a/includes/files.inc
    +++ b/includes/files.inc
    @@ -213,7 +213,7 @@ class backup_file {
    /**
    • Construct a file object given a file path, or create a temp file for writing.
      */
  • function backup_file($params = array()) {
  • function __construct($params = array()) {
    if (isset($params[‘filepath’]) && file_exists($params[‘filepath’])) {
    $this->set_filepath($params[‘filepath’]);
    }

My log

local-by-flywheel.log (149.7 KB)

Any idea what’s wrong?

When I upgraded my website PHP from version 5.6 to 7.2, I encountered this problem “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”. It turns out that mysql extension is no longer supported in php version 7.2. It is now using mysqli extention. I am using old version of wordpress which still using mysql extension that is why the problem existed. So what I did is upgraded the wordpress to the core. This solve the problem.

Here’s the steps I followed when upgrading wordpress manually.

  1. First I created a full backup of my website [http://www.fractioncalc.com](http://mixed fraction calculator). This is very important in case of mistake.
  2. I download the newest WordPress ZIP file from wordpress.org.
  3. I unzipped the file into a local directory of my computer.
  4. I went to my website root directory and deleted your ‘wp-includes’ and ‘wp-admin’ directories. I used sFTP connection using Filezilla software.
  5. I uploaded the new wp-includes and wp-admin directories from the new version of WordPress I unzipped to my website root directory and replaced the directories I just deleted.
  6. I did not delete the wp-content directory or any of the files in that directory. I just copied over the files from the wp-content directory in the new version of WordPress to my existing wp-content directory. All existing files with the same name have been overwritten.
  7. I copied all files from the root (‘/’) directory of the new version of WordPress that I unzipped into my website root directory (or the root directory of your WordPress installation). Existing files has been overwritten and new files has been copied across. wp-config.php file was not be affected because WordPress has never distributed with a wp-config.php file.
  8. I compare wp-config-sample.php which was\s distributed with WordPress but did not find anything to change so I just used the old one.
  9. I cleared my browser cache to ensure I can see all changes.
  10. I checked the site and there is no error now. Thanks God the upgrade was completed.

Hey @Turnspike

I noticed that in the instructions that were provided, PHP and MySQL were being downgraded with apt-get:

Since Local handles PHP versions in a different way, this won’t work. You’ll need to make use of a Custom Environment to dial in the specific versions of software.

As for the general errors on the site – the newest version of PHP 7.2 deprecates a number of MySQL functions. You might take a look at this StackOverflow question: https://stackoverflow.com/questions/21797118/deprecated-mysql-connect

If this is coming from plugins, you can try updating to the most recent versions. If the errors are coming from a custom theme or plugin, take a look at that StackOverflow message and that should help get you in the right direction.