PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] php version mismatch with composer

 February 09, 2022     apache, composer-php, cpanel, php, version     No comments   

Issue

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?


Solution

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.



Answered By - Héctor Paúl Cervera-García
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing