How does php composer know 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 on a 5.1.5 server. He initially had PHP 5.5.x installed, but I upgraded to PHP 5.6.x and checked it with phpinfo (). However, when I try to run the linker to install the Zend Framework 3 modules, it responds that this cannot be done with the installation of PHP 5.5.x. Restart, etc. Irrelevant. How does the composer tell you which version of PHP is being used, and how can I convince her that PHP 5.6.x is installed?

+6
source share
2 answers

When I understand correctly, your server is already PHP 5.6 and should be able to run ZF3, but the CLI is PHP 5.5, and Composer stops extracting ZF3 modules because 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 current PHP used in the CLI.

Two solutions come to me:

  • update your PHP used in CLI, or
  • add --ignore-platform-reqs to the composer's team. This ignores the env checks and pretends that everything is in order. Keep in mind that this will also disable checks for extensions that may be required by some modules.
+1
source

For those who do not know how to change the PHP version for Composer when using WAMP on Windows :

Composer uses a version of PHP that can be run from the terminal. Thus, on Windows Composer (and therefore the terminal) knows the version of PHP from the Path system variable.

You can easily change the value inside System β†’ Advanced system settings β†’ environment variables. Inside the Path variable, there must be a value of type C:\wamp64\bin\php\php5.6.25 . After changing the value, a restart is required.

You can always find out the version of PHP in threads by running php -v inside the terminal.

+1
source

All Articles