You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
I recently spun up a JN site, and specified PHP 8.0. The site itself was configured correctly, but when I went to run commands using WP CLI, I discovered that the version of PHP being used for the command line interface is the default, currently PHP 7.4. This causes an PHP 8 features to trigger a fatal error when CLI is executed for the site.
Here is the output from wp --info on CLI:
wp --info
OS: Linux 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Shell: /bin/bash
PHP binary: /opt/sp/php7.4/bin/php
PHP version: 7.4.30
php.ini used: /etc/php7.4-sp/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
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: /srv/users/user95535f5e/apps/user95535f5e/public
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0
Doing some digging, I see that /usr/bin/wp is a simple wrapper to call the wp-cli.phar file:
With this in mind, setting up the site should include mapping /usr/bin/wp to use the correct version of PHP based on the site options. It might be beneficial to also change the native PHP being called, but using WP CLI will likely be the more prevalent use case.
As a workaround, I found that the PHP 8 executable is available (along with other version), but it needs to be specified manually to work properly with WP CLI:
php8.0-sp /opt/sp/bin/wp-cli.phar --info
OS: Linux 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Shell: /bin/bash
PHP binary: /opt/sp/php8.0/bin/php
PHP version: 8.0.20
php.ini used: /etc/php8.0-sp/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
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: /srv/users/user95535f5e/apps/user95535f5e/public
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0
Steps to reproduce
Spin up a new site with Jurassic Ninja, specifying PHP 8 as the version
Visit Dashboard > Tools > Site Health > Info. Look under the "Server" section to see the version of PHP being used
From the command line, run wp --info or php --version to see that a different version of PHP is being used.
The text was updated successfully, but these errors were encountered:
The CLI version is controlled on the server and is not something the JN site controls. Unless you mean the Docker image defaults? In this case this is something that should be fixed. :)
I recently spun up a JN site, and specified PHP 8.0. The site itself was configured correctly, but when I went to run commands using WP CLI, I discovered that the version of PHP being used for the command line interface is the default, currently PHP 7.4. This causes an PHP 8 features to trigger a fatal error when CLI is executed for the site.
Here is the output from
wp --info
on CLI:Doing some digging, I see that
/usr/bin/wp
is a simple wrapper to call thewp-cli.phar
file:With this in mind, setting up the site should include mapping
/usr/bin/wp
to use the correct version of PHP based on the site options. It might be beneficial to also change the native PHP being called, but using WP CLI will likely be the more prevalent use case.As a workaround, I found that the PHP 8 executable is available (along with other version), but it needs to be specified manually to work properly with WP CLI:
Steps to reproduce
wp --info
orphp --version
to see that a different version of PHP is being used.The text was updated successfully, but these errors were encountered: