skip to Main Content

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 and composer self-update but it says allow_url_fopen is disabled, but I enabled it with a cpanel tool called "MultiPHP INI editor", and phpinfo() 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


  1. change in composer.json

    "require": {
        "php": "^7.3.2",
    ......
    }
    

    it may works

    Login or Signup to reply.
  2. 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 your phpinfo() page) might not match.

    Try running this in your console:

    $ php -v
    

    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:

    /usr/bin/php7.3 /usr/local/bin/composer install
    

    This was assuming that your composer binary is under /user/local/bin/composer, modify as need.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search