I want to install php dependencies in a shared-hosting server, but composer says my php version is 5.6.40
(too old for my dependencies), It was true, so I set the php version from cpanel to 7.3.23
with something called "MultiPHP manager". All right, until I retried to run composer install
, composer keep saying that my php version is 5.6.40
.
Then I checked the phpinfo()
in a dummy page and it says my version is 7.3.23
. Also I ran php -v
and the output says my version is 7.3.23
.
I tried
- reload
httpd
- run
composer update
andcomposer self-update
but it saysallow_url_fopen
is disabled, but I enabled it with a cpanel tool called "MultiPHP INI editor", andphpinfo()
says that is enabled.
Someone can tell me if im doing something wrong? or how does composer can’t use the updated php?
2
Answers
change in composer.json
it may works
Your cli php version (the one you are using for your
composer install
) and the php version your apache is running in your server (the one you see in yourphpinfo()
page) might not match.Try running this in your console:
This would output the version you are actually using when running your
composer install
To run the same version in your server, you might need to locate the PHP 7 binary on your machine (maybe
/usr/bin/php7.3
, you could try to execute a$ whereis php
), then:This was assuming that your composer binary is under
/user/local/bin/composer
, modify as need.