Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does php composer know the php version?

Having successfully upgraded my test site (Debian Linux) to Zend Framework 3, I want to repeat the exercise on OS X El Capitan running Server 5.1.5. Originally this had PHP 5.5.x installed but I've upgraded to PHP 5.6.x and verified this with a phpinfo() display. However, when I try to run composer to install Zend Framework 3 modules, it responds that it can't be done as PHP 5.5.x is installed. Restarting etc. makes no difference. How does composer tell which PHP version is in use and how can I convince it that PHP 5.6.x is installed?

like image 569
user3017691 Avatar asked Jul 19 '16 12:07

user3017691


People also ask

What version of PHP does composer use?

- Root composer. json requires php >=7.4 but your php version (7.3. 14) does not satisfy that requirement.

How do I know PHP version?

Check PHP Version by Running PHP Code The simplest method to determine the PHP version running on your website is executing a PHP file that contains the following code: <? php echo 'PHP version: ' . phpversion();

How do I update PHP version in composer json?

To update your packagesNavigate to the root of your git repo, where your composer. json file is. Run composer update (on your local machine) to update the required packages and re-generate a composer. lock file.


1 Answers

When i understand correctly, then your server is already PHP 5.6 and should be able to run ZF3, but the CLI is PHP 5.5 and Composer stops fetching the ZF3 modules, because the PHP is too low, right?

You have one PHP for the CLI and another PHP for the server. When you run composer it will check the PHP version of the currently running PHP used from the CLI.

Two solutions come to my mind:

  • update your PHP used on the CLI or
  • append --ignore-platform-reqs to your composer command. This will ignore the env checks and pretend everything is ok. Keep in mind that this will also disable checks for extensions, which might be needed by some of the modules.
like image 99
Jens A. Koch Avatar answered Oct 27 '22 08:10

Jens A. Koch