When I try to use any grav command via SSH I get an error like this:
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or ‘(’ in /…/grav/bin/grav on line 9
I guess it has to do with the fact that my hosts default is an old cli version of PHP.
It’s possible to use a different version, eg:
But I don’t know if
a) this realli is the reason for the error
b) if so, what I had to for grav to use another version
Any hints would be greatly appreciated. As I’m not a console guy I’m looking forward for a way that helps me do what I have to do to get access to the grav cli. So I can begin to understand.
First check which version of php you are running by default:
$ php -v
If it’s the wrong version, you just need to put the path to the PHP binary in your path, before the regular one. This usually means, putting the explicity PHP7 bin path at the front of your path variable. Depending on your platform, and OS, this is going to require some googling. For example on a linux-based system that is running Bash shell, you would add it to the front of path variable in
Thanks a lot. php -v gets an old version. According to this thread, it’s possible to configure a .bshrc I just don’t understand how.
(Thread is German but should be understandable for a geek, alt least the code part
I tried to nano .bashrc and it opened an empty editor. Would this be the place to configure something?
Sorry for asking dumb, I should learn this…
Depending on the host, I find it easier to check if their PHP versions are just renamed executables. For example, my host uses
php70 for PHP v7, so I can just substitute it for
I don’t want to execute any php-commands directly but grav commands which obviously depend on a minima php version. I still don’t get how I execute something like
Where can I set the correct php version to execute?
Ok, I tried:
/usr/local/bin/php7-70STABLE-CLI bin/gpm selfupgrade
That might do the trick.
Just wonder if it is possible to not have to enter this long path everytime
You should ask your host. There are usually command aliases when multiple versions are available, as for example when I do the same I do not need the executable path but just
php70 bin/gpm selfupgrade.