Skip to content

Config command error with PHP 8.5 installed with some 8.4 dependencies #210

Closed

Description

@josvlaar

Bug Report

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.

Activity

  1. swissspidy commented on Feb 11, 2026

    @swissspidy
    Member

    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 with php -m | grep mysqli.

  2. josvlaar commented on Feb 12, 2026

    @josvlaar
    Author

    I'm trying to install php8.5-mysqli but I get:

    Note, selecting 'php8.5-mysql' instead of 'php8.5-mysqli'
    php8.5-mysql is already the newest version (8.5.2-1+ubuntu24.04.1+deb.sury.org+1).
    

    php -m | grep mysqli results in nothing so it's definitely not installed. Is it even different from php-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 for mysqli, if it's identical to mysql?

  3. swissspidy commented on Feb 12, 2026

    @swissspidy
    Member

    mysqli stands 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 info output. Does php --version also 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: run wp cli update --nightly afterwards for improved PHP 8.5 supported)

  4. josvlaar commented on Feb 12, 2026

    @josvlaar
    Author

    Having multiple PHP versions installed should not be a problem. The 8.4 packages were a dependency of the PPA's wp-cli and php-cli packages. php --version did 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 a wp cron event run --due-now cron job) also stopped working because mysqli was not installed/enabled.

    I have now found a solution. It requires running sudo update-alternatives --config php to select version 8.5 as the default PHP version used. Apparently, mysqli is no longer a separate package in PHP 8.5 and is installed by default. The PHP 8.4 dependencies didn't have mysqli installed, which is why the cron job and wp core config didn't work. They do work now!

  5. swissspidy commented on Feb 12, 2026

    @swissspidy
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions