PHP composer error


#1

I’d like to play with a Laravel app, which requires PHP 7.1+. I followed this article’s instructions and bumped the version on the subdomain to 7.2.

[me@server photos.ohheybrian.com]$ php -v
PHP 7.2.17 (cli) (built: Apr  9 2019 04:39:36) ( NTS )

When I SSH into the directory and run the composer script, I get an error that my PHP version is too low:

 Problem 1
    - This package requires php ^7.1.3 but your PHP version (7.0.33) does not satisfy that requirement.
  Problem 2
    - Installation request for doctrine/cache v1.8.0 -> satisfiable by doctrine/cache[v1.8.0].
    - doctrine/cache v1.8.0 requires php ~7.1 -> your PHP version (7.0.33) does not satisfy that requirement.
  ...

So, it looks like my CLI version was updated, but not the runtime. Is there another spot to change that version?


#2

You might try changing the PHP version for your primary cPanel domain to see if that helps. If not it may be reading the server-level default which is very odd but not something we could change.


#3

Looking at my server information in cPanel, it’s showing the 7.0.33 version, which matches the error code. I’m going to assume there’s no way of updating that on shard hosting, right?


#4

That’s correct, that is the default version at the server level. Shared hosting accounts have the ability to change it through the link you mentioned previously. I don’t know why Composer would be reading a different version if both the site and CLI are reading it as 7.2 though.


#5

Ok, no problem. I’ll post to the git repo to see if anyone else is using cPanel and what they did.


#6

Found this in case something there is useful Composer uses wrong php version, but php -v shows the correct one (Ubuntu) - Stack Overflow