trying to use wp cli in the localwp site shell but running into
“Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Please check that the mysqli PHP extension is installed and enabled.”
Troubleshooting Questions
Does this happen for all sites in Local, or just one in particular?
yes, every site I’ve tried to import or create from new.
Are you able to create a new, plain WordPress site in Local and access it in a Browser?
hi Nick!
I have to use php 7.4.3 on the site
Wordpress version 6.2.2
mysql 5.7.28
my computer php version is php 8.2.6. does my computer php have to be the same version as the local website? sorry if this is an obvious question I’m newbie.
I did manage to install the MySQL extension but am now getting a
“Error establishing a database connection error” when I try to run
npx @wpcs.io/cli local package
the command is supposed to take my local wordpress site and package it into a snapshot I can deploy to wpcs.io via cli
Also noticed on the website’s info.php browser output that the Configuration File Path & extension_dir are pointing to directories on my computer that don’t exist?
So I guess my questions are do I need to switch my computer’s php 8 to match the website’s php 7?
And second question would be how do I change the Configuration File Path and extension_dir for the local website - and what path should they be pointing to?
also when I run
mysql initialize
I’m getting
ERROR 1045 (28000): Access denied for user 'cc'@'localhost' (using password: NO)
Hey @dolldothouse – Welcome to the Local Community Forums!
From the terminal screenshot, it looks like the shell may not have been opened from the “Open site shell” button in Local. I say that because I see one of the first commands is a cd command to the site folder.
You’ll want to make sure that when opening a shell for a Local site, be sure to do it by clicking the “Open site shell” in Local.
The reason for this is that clicking that button adds various environment variables that are specific to the php/mysql processes. Here’s a screenshot of my machine to help visualize what I mean:
bad news is I have the localwp bug where when I click open site shell it opens then immediately closes. found that the site shell stays open under php 7.3 but my process specifically requires 7.4. development purgatory of sorts so my workaround for that was cd into the localwp site’s public folder.
good news is I got it working anyway
quick overview is
manually enter site shell
add the mysql extension by editing the website’s php.ini file
change the default sockets in php.ini file to the Socket path listed in localwp Database settings
deal with any keyring migration errors by installing chaotic keyring.
deal with any character set errors involving utf8 by editing the Index.xml file to say utf8mb3
SOLVED: Workaround for “Open Site Shell” closing immediately in PHP 7.4.30:
try changing your localwp php version to 7.3.5 and then Open Site Shell again. should work.
if you have to use php 7.4.30 like I did just open your regular terminal and drop into the website’s public directory and use it like you would use the Open Site Shell terminal.
cd /home/username/Local Sites/sitename/app/public
bonus tip: in Garuda Linux if Open Site Shell doesn’t work at all you need to install gnome-terminal
sudo pacman -S gnome-terminal
SOLVED: Error Your PHP installation appears to be missing the MySQL extension which is required by WordPress. Please check that the mysqli PHP extension is installed and enabled"
find your extension_dir
php-config --extension-dir
copy the output to use as the extension_dir in your website’s php.ini (my php.ini was at /home/username/Local Sites/sitename/conf/php-7.4.30/php.ini)
open Visual Studio Code to edit php.ini file and add: