1

I am running a self-administrated 1and1 dedicated server:

CentOS 6.10 (Final) Linux 2.6.32-504.30.3.el6.x86_64

and getting the following error: "PHP Fatal error: Your PHP version must be equal or higher than 5.6.0 to use CakePHP". My initial thought is I have missed setting the path for PHP somewhere. I have tried checking/changing the following things, and I'm not sure what else to try.

phpinfo() shows:

PHP Version 7.3.7

php -v shows:

PHP 7.3.7 (cli) (built: Jul 5 2019 12:52:53) ( NTS )

bin/cake produces:

PHP Fatal error: Your PHP version must be equal or higher than 5.6.0 to use CakePHP.

Removing from requirements.php:

if (version_compare(PHP_VERSION, '5.6.0') < 0) {
     trigger_error('Your PHP version must be equal or higher than 5.6.0 to use CakePHP.' . PHP_EOL, E_USER_ERROR);
 }

bin/cake again after that line removed:

PHP Fatal error: Class 'DateTimeImmutable' not found in /var/www/vhosts/xxxxxxxxxx.com/app/vendor/cakephp/chronos/src/Chronos.php on line 50

which php shows:

alias php='/opt/plesk/php/7.3/bin/php' /opt/plesk/php/7.3/bin/php

HFBrowning
  • 2,196
  • 3
  • 23
  • 42
smoeckel
  • 13
  • 5
  • 1
    Check `phpinfo()` from inside a web page. The version of PHP you're running from the command line may not be the same as what your web server is running. – Greg Schmidt Jul 29 '19 at 22:17
  • src/Template/Pages/home.ctp. Shows Your version of PHP is 5.6.0 or higher (detected 7.3.7) and echo phpinfo() shows PHP Version 7.3.7 – smoeckel Jul 30 '19 at 13:46
  • So, it says that your version of PHP is 5.6.0 or higher, but also gives a fatal error that it must be 5.6.0 or higher to run? – Greg Schmidt Jul 30 '19 at 18:12
  • Just to clarify. Currently only failing when I try to bake. Still working with the default install from "php composer.phar create-project --prefer-dist cakephp/app". It did install without any errors. Everywhere I check shows PHP Version 7.3.7. Both on the cli and html (phpinfo) pages. It is only when I try to bake that I get the error. It's like bake is looking in some obscure place for the PHP version. – smoeckel Jul 30 '19 at 20:32
  • Bake is just code, you can look at it and debug it. You ran `composer install` after the initial `create-project`, yes? – Greg Schmidt Jul 31 '19 at 03:02
  • I did not run composer install after creating the project with composer. When I ran composer install, it failed because of the php version being to low. I looked at bake.php and commented out the requirments section. bake then throws the error PHP Fatal error: Class 'DateTimeImmutable' not found – smoeckel Jul 31 '19 at 14:15
  • I edited src/Template/Pages/home.ctp and changed how it is checking for the php version to match requirements.php (version_compare(PHP_VERSION, '5.6.0', '>=')) vs (version_compare(PHP_VERSION, '5.6.0' < 0)) and now the home page indicates the php version is to low. I am now going to focus on how PHP_VERSION is checking. Thanks for your help so far. I am just trying to follow the Content Management Tutorial – smoeckel Jul 31 '19 at 14:20
  • You've changed it to trigger the error message about version being to low when the version is greater than or equal to 5.6.0? That code was right before. I can't tell yet where your actual problem is, but if you can't run `composer install`, then that's going to lead to all kinds of other problems. – Greg Schmidt Jul 31 '19 at 16:09
  • This is a server problem. My solution was to switch to a single php version server. Not sure how to mark this question as closed so people don't waste any time – smoeckel Aug 06 '19 at 16:16

0 Answers0