Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Installation & Hosting

Installation on 1&1 - php version

Started by Philip C 7 years ago · 3 replies · 3079 views
7 years ago

Hello,
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
<b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in <b>/homepages/25/d313203090/htdocs/domain/bin/gpm</b> on line <b>4</b><br />
Is this a php issue I need to take up with 1&1 or is it something to be done within Grav?

Thanks

👍 1
7 years ago

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
6 years ago

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)
https://www.ionos.de/hilfe/hosting/php-fuer-web-projekt-verwenden/php-dateien-mittels-php-cli-in-der-kommandozeile-shell-ausfuehren/

6 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 18 hours ago
7 63 17 minutes ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 65 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 64 8 months ago
Installation & Hosting · by N, 12 months ago
3 76 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 63 1 year ago