I'm trying to run composer commands from the SSH terminal but I get this
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.33". You are running 7.1.33.
when I run php -v
I get PHP 7.3.33 (cli)
and when I run phpinfo()
in Laravel (not the terminal) I get PHP Version 7.3.33
In composer.json:
"require": {
"php": "^7.3.33",
In .htaccess
<IfModule mime_module>
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
Why does this happen and how can I fix it?
CodePudding user response:
Note that .htaccess
only affects the Apache configuration. When accessing the server via SSH the file is completely ignored/useless.
Some providers install multiple versions of PHP, making it available by typing php7.3
, and the php
is a simple alias to the current default version. Probably the composer is set up in a way to use a different version of the default (not sure how/why) while your ssh session is using another.
Since your php -v
is reporting the desired version. I would suggest downloading composer.phar
and running it locally via php composer.phar ...
instead of relying on the currently systemwide installed composer.