Installation on 1&1 - php version

I have just started an installation on my webspace provided by 1&1 / ionos.
Within the hosting environment the php version is 7.3 but when I access through SSH the php version is 4.4.9. When I try to install the admin plugin through gpm I get the error
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or ‘(’ in /homepages/25/d313203090/htdocs/domain/bin/gpm on line 4

Is this a php issue I need to take up with 1&1 or is it something to be done within Grav?


1 Like

It’s a problem at 1&1, their CLI is set to an ancient, outdated, unsupported, and not to be used version of PHP. You can change the PHP version with 1&1, but it won’t necessarily affect the CLI.

A few things to try:

  1. Does which php list several available installations of PHP?
  2. Does /usr/bin/php7.1-cli --version report a PHP-version?
  3. Can you inspect /usr/bin/ to look for more up to date versions of PHP?
1 Like

I’m pretty new to Grav (and the CLI/Putty Stuff) and after digging into all the stuff I challenged the same Problem:
Host 1&1 - PHP SSH Version 4.x.x --> not able to perform a single command, always got that error because of the outdated php version.

Although this solution might not help you since its propably to late I hope it helps some people looking for that issue in the future.

I first found and tried a solution creating a .bash_profile with alias php=[…]
Since then php -v showed the current PHP version but I still couldn’t perform a single command and got the PHP/4.4.9 Error

Then I found this at a 1&1 Website - works fine:
Just put “/usr/bin/php7.x-cli” (x the number of your prefered php version) before the command
For you it should look like this:

$ /usr/bin/php7.3-cli bin/gpm install admin

Hope this works for you/others facing the same problem too.

1&1 Website with solution (german)

Another solution: Each time you type a command that will use php you can manually tell the cli which version of php to use. So for example:
For: bin/grav cache
type: php7.3-cli bin/grav cache