Look in wp-includes/version.php
/**
* The WordPress version string
*
* @global string $wp_version
*/
$wp_version = '2.8.4';
Answer from Paul Dixon on Stack OverflowHow do I find out what version of WordPress is running? - Stack Overflow
WP-CLI - Selecting PHP version
How to check PHP compatibility?
identifying PHP Version from Source Code
Which PHP version is compatible with WordPress?
The minimum PHP version that is compatible with WordPress is PHP 5.2.6. Although your host may offer this as an option, it’s not necessarily the best or safest. Other PHP versions compatible with WordPress are PHP 5.3 – 5.6 and PHP 7 and higher. WordPress recommends using PHP 7.4.
How do I know if PHP is working?
If you visit your WordPress site and everything appears to be functioning and displaying as it should, your PHP is likely working. However, if there are any issues or an update is required, you can find them listed under the Site Health tool from your WordPress dashboard.
Also, to ensure a PHP version works with your site, it’s important to check the PHP compatibility of your themes and plugins. For this, you may want to use a plugin such as PHP Compatibility Checker. Once installed, it will display errors and warnings related to your PHP version and WordPress compatibility. However, as we mentioned earlier, this plugin hasn’t been tested with the latest versions of WordPress.
Videos
Look in wp-includes/version.php
/**
* The WordPress version string
*
* @global string $wp_version
*/
$wp_version = '2.8.4';
Unless he edited some code to delete this, you should be able to view source on the site and look for this meta tag:
<meta name="generator" content="WordPress 2.7.1" />
That will give you the version.
On a system where
- you can't change the
/usr/bin/phpsymlink - you can't change the
PATHto point to a different version (because the php executables don't reside in distinct/lib/directories) WP_CLI_PHPhas no effect
(like my Arch Linux with php(8), php7 installed from extra and wp-cli installed from AUR. I'm using php7 vs php8 here, but this should work for any versions.)
…a workaround may be to call the wp phar executable with php7 cli:
whereis wp
# /usr/bin/wp
php7 /usr/bin/wp cli info
# PHP binary: /usr/bin/php7
# PHP version: 7.4.25
for convenience you can add a bash alias in your .bashrc:
alias wp-php7='php7 /usr/bin/wp'
# or override wp altogether
alias wp='php7 /usr/bin/wp'
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.