On a development server I have a co-install of PHP 5.6 & 7; nginx is configured with PHP 5.6. When I type “wp” it returns several errors and at the end of the error is a message containing the following:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Typing wp –info returns:
PHP binary: /usr/bin/php7.0
PHP version: 7.0.10-2+deb.sury.org~precise+1
php.ini used: /etc/php/7.0/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config: /srv/www/wp-cli.yml
WP-CLI project config:
WP-CLI version: 0.26.0-alpha-5672b63
WP-CLI seems to be defaulting to PHP 7, I would prefer it to use PHP 5.6.
So I was wondering if there was an option I could add to the configuration yml file to select which PHP version to use?
If you need any further information, please let me know
Got the same problem! Just switch the php version.
On my server PHP5.6 was default for apache, while CLI was configured with PHP7.1. After installing WP-CLI, with wp --info
I got this result:
PHP binary: /usr/bin/php7.1
PHP version: 7.1.5-1+deb.sury.org~xenial+1
php.ini used: /etc/php/7.1/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
And when i used the wp core install command i got the error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
The problem is just the mix between the different versions: we have just to switch completely to 5.6 or 7.1.
In my case problem was solved simply by writing on the shell:
sudo update-alternatives --set php /usr/bin/php5.6
And then wp --info
PHP binary: /usr/bin/php5.6
PHP version: 5.6.30-10+deb.sury.org~xenial+2
php.ini used: /etc/php/5.6/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
Problem solved! WP-CLI worked like a charm.