0

I am trying to make a bash script on my server to clear the Grav cache. When I run it from the server, it works fine. But when I run it from my local machine, over SSH, I get an error: You are running PHP 5.6.36, but Grav needs at least PHP 7.1.3 to run. However, php -v on my server returns PHP 7.2.11 (cli) and on my local machine returns PHP 7.1.23 (cli). I do not begin to understand what the problem might be.

In the end, I could not resolve the issue of the different PHP versions, but solved the problem by including the path to the correct PHP version in the server script. So, locally I have ssh jeremygrav@ps589716.dreamhostps.com "bash ./clear.sh" and on the server, the script contains /usr/local/php73/bin/php bin/grav cache --all.

That works fine, although I realise it avoids the problem rather than solving it.

jcherfas
  • 15
  • 6
  • Check your server configuration. Maybe your webserver uses php-fpm which is different. – Markus Zeller Oct 26 '19 at 10:33
  • @MarkusZeller The question says he's getting the error when he runs it in the CLI, not the webserver. – Barmar Oct 26 '19 at 10:36
  • @Barmar Yes, so check the config to see if it is a different php version. Please read what I wrote stating that. – Markus Zeller Oct 26 '19 at 10:39
  • How are you running the BASH script? Under which user account, environment. Try simply writing out the PHP_VERSION when called the same to confirm. You can have multiple versions installed, and may need to use a different path to the binary. – Progrock Oct 26 '19 at 10:44
  • Can you clarify how you run it from the server and it works fine? – Progrock Oct 26 '19 at 10:45
  • I have edited the question to reflect the solution I am using. – jcherfas Oct 26 '19 at 12:40
  • Sounds like you just need to set your `PATH` environment variable to include the `/usr/local/php73/bin` directory, or put a symlink to PHP 7 in `/usr/bin`. – Barmar Oct 28 '19 at 15:36

0 Answers0