Support

Akeeba Backup for WordPress

#39920 platform_check.php gets wrong PHP Version

Posted in ‘Akeeba Backup for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
6.4.1
PHP version
8.1.22
Akeeba Backup version
8.1.1

Latest post by [email protected] on Tuesday, 05 December 2023 02:03 CST

[email protected]

Hi,

I use the automatc backup method "alternative crontab" like described here https://www.akeeba.com/documentation/akeeba-solo/automating-your-backup.html#alternative-cron-script.

If I run the Script /usr/bin/php /www/htdocs/w01a15c8/toboit.de/wp-content/plugins/akeebabackupwp/app/cli/backup.php --profile=1 the Backup Job run successfully. But my Hoster force me to run a PHP-CGI Bridge Skript.

<?php
exec("/usr/bin/php /www/htdocs/w01a15c8/toboit.de/wp-content/plugins/akeebabackupwp/app/cli/backup.php --profile=1 2>&1", $out, $result);
echo "Returncode: " .$result ."<br>";
echo "Ausgabe des Scripts: " ."<br>";
echo "<pre>"; print_r($out);
?>

If you put this url i a browser, you get the following error message:

Returncode: 255
Ausgabe des Scripts:

Array
(
    [0] => PHP Fatal error:  Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.2.34-nmm8. in /www/htdocs/w01a15c8/toboit.de/wp-content/plugins/akeebabackupwp/app/vendor/composer/platform_check.php on line 24
    [1] => 
    [2] => Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.2.34-nmm8. in /www/htdocs/w01a15c8/toboit.de/wp-content/plugins/akeebabackupwp/app/vendor/composer/platform_check.php on line 24
)

But the Wordpress site runs definitly unter PHP 8.1

ls -al /usr/bin/php
lrwxrwxrwx 1 ssh-w01a15c8 w01a15c8 5 Dez 2 18:53 /usr/bin/php -> php81

What can be the problem here?

Regards
Thomas

 

nicholas
Akeeba Staff
Manager

Remember, there is “detection” of the PHP version. This the version that PHP itself reports with the PHP_VERSION constant and the phpversion() built-in function. Moreover, the message comes from Composer, the PHP dependency manager used by billions of PHP installations. The likelihood of Composer being so fundamentally broken is exactly zero. Whatever the reason, PHP reports that it's version 7.2.

The fact that your host is asking you to use a PHP script to run a PHP script sounds very suspicious. Is it possible that they execute it in an environment where /usr/bin/php is somehow aliased to PHP 7.2?

Is there a reason they cannot let you run a Bash script such as:

#!/usr/bin/env bash
/usr/bin/php /www/htdocs/w01a15c8/toboit.de/wp-content/plugins/akeebabackupwp/app/cli/backup.php --profile=1 2>&1

instead of a PHP script?

If you definitely need to run a PHP script, add another couple lines:

echo sprintf("PHP_VERSION reports %s\n", PHP_VERSION);
echo sprintf("phpversion() reports %s\n", phpversion());

Which PHP version is reported here?

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

[email protected]

Hi Nicholas,

OK I will change it to a BASH Script and close this Ticket.

 

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!