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.”
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?
Arch Linux/Garuda Linux
- Attach the Local Log. See this Help Doc for instructions on how to do so:
local-logs.zip (23.0 KB)
So when you spin a site up are you always using PHP 7.4.3 or does it matter what PHP version you use?
What WordPress and mysql versions are you selecting?
I have to use php 7.4.3 on the site
Wordpress version 6.2.2
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
ERROR 1045 (28000): Access denied for user 'cc'@'localhost' (using password: NO)
thanks for your help!
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
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:
- save php.ini file
SOLVED: ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’
- In localwp go to Database settings and copy the Socket path
- Paste into the php.ini file for default socket values
mysql.default_socket = "/the/socket/path/copied/from/localwp"
mysqli.default_socket = "/the/socket/path/copied/from/localwp"
pdo_mysql.default_socket = "/the/socket/path/copied/from/localwp"
- save php.ini file
SOLVED: keyring migration error
sudo pacman -Sy chaotic-keyring
SOLVED: Character set ‘utf8’ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml’ file
- open the Index.xml file specified in the error message.
- edit charset name=“utf8” to charset name=“utf8mb3”
- save file
- restart your localwp site for good measure.
Below is the successful export of my localwp site to wpcs using npx command found in the npm package
hope this helps someone with my obscure version of Linux!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.