Repository navigation
Config command error with PHP 8.5 installed with some 8.4 dependencies #210
Copy link
Copy link
Closed
Labels
Description
Bug Report
- [ x ] Yes, I reviewed the contribution guidelines.
- [ x ] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
I'm trying to clean install WordPress with PHP 8.5 on Ubuntu 24.04 LTS. I'm pulling PHP from ppa:ondrej/php. I run the following command:
sudo apt install php8.5-fpm php8.5-common php8.5-mysql \
php8.5-xml php8.5-intl php8.5-curl php8.5-gd \
php8.5-imagick php8.5-cli php8.5-dev php8.5-imap \
php8.5-mbstring php8.5-redis \
php8.5-soap php8.5-zip -y
I'm pulling wp-cli and php-cli from ppa:tiagohillebrandt/wp-cli. When installing, php8.4-cli php8.4-common php8.4-opcache php8.4-readline are also installed as a dependency. When I get to running wp core config, I get the following output:
PHP Fatal error: Uncaught Error: Call to undefined function mysqli_init() in phar:///usr/bin/wp/vendor/wp-cli/config-command/src/Config_Command.php:217
Stack trace:
#0 [internal function]: Config_Command->create()
#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::{closure:WP_CLI\Dispatcher\CommandFactory::create_subcommand():97}()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func()
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(470): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(493): WP_CLI\Runner->run_command()
#6 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1233): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(84): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(35): WP_CLI\bootstrap()
#10 phar:///usr/bin/wp/php/boot-phar.php(20): include('...')
#11 /usr/bin/wp(4): include('...')
#12 {main}
thrown in phar:///usr/bin/wp/vendor/wp-cli/config-command/src/Config_Command.php on line 217
Seems to be something with MySQL. I have installed that repository from wget https://dev.mysql.com/get/mysql-apt-config_0.8.36-1_all.deb. Nothing strange here.
WP CLI environment:
OS: Linux 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php8.4
PHP version: 8.4.17
php.ini used: /etc/php/8.4/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.4.8 for Linux on x86_64 (MySQL Community Server - GPL)
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: phar:///usr/bin/wp
WP-CLI packages dir:
WP-CLI cache dir: /home/itwithme-ictmee/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.12.0
I have no idea how this is caused or how it can be fixed. It went wrong on a clean installed Virtualbox VM with Ubuntu 24.04 default image.
Reactions are currently unavailable
Activity
swissspidy commentedon Feb 11, 2026
It looks like the PHP MySQL extension is not installed or not properly loaded. You'll want
php-mysqli(with the i at the end). Verify withphp -m | grep mysqli.josvlaar commentedon Feb 12, 2026
I'm trying to install
php8.5-mysqlibut I get:php -m | grep mysqliresults in nothing so it's definitely not installed. Is it even different fromphp-mysql?How can I force apt to install it and not reselect a different package? Is this a MySQL bug or should WP CLI switch to using
php-mysql? Or should MySQL create a symlink somewhere formysqli, if it's identical tomysql?swissspidy commentedon Feb 12, 2026
mysqlistands for "MySQL Improved" and is the new version of the PHP MySQL extension. The PHP MySQL extension is what enables PHP to talk to the database.This is not to be confused with the MySQL database itself. Your MySQL installation is probably fine. So this is not an issue with MySQL, just your PHP configuration.
It's confusing that you installed both PHP 8.5 and 8.4, at least according to your
wp cli infooutput. Doesphp --versionalso say 8.4? Maybe you installed the msyql extension for 8.5 but not 8.4. I would just stick with 8.5 and remove the 8.4 packages.FWIW I am not familiar with
ppa:tiagohillebrandt/wp-cli(which appears to have caused 8.4 to be installed). I suggest sticking with our recommended installation approach. (Tip: runwp cli update --nightlyafterwards for improved PHP 8.5 supported)josvlaar commentedon Feb 12, 2026
Having multiple PHP versions installed should not be a problem. The 8.4 packages were a dependency of the PPA's
wp-cliandphp-clipackages.php --versiondid indeed also say PHP 8.4 is loaded. Apparently, the few dependencies of 8.4 changed the default PHP version used, even though 8.5 was fully installed and 8.4 was only partially. The latter of the two installed seems to have become the default, not necessarily the newest one. As a sidenote, my WordPress cron jobs (running through awp cron event run --due-nowcron job) also stopped working becausemysqliwas not installed/enabled.I have now found a solution. It requires running
sudo update-alternatives --config phpto select version 8.5 as the default PHP version used. Apparently,mysqliis no longer a separate package in PHP 8.5 and is installed by default. The PHP 8.4 dependencies didn't havemysqliinstalled, which is why the cron job andwp core configdidn't work. They do work now!swissspidy commentedon Feb 12, 2026
Glad to hear it's working now!
If you have any further questions, feel free to join the #cli channel in the WordPress.org Slack