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?
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.
For others who don´t know how to change the PHP version for Composer when using WAMP on Windows:
Composer uses the PHP version which can be run from the terminal. So on Windows the Composer (and so the terminal) knows the PHP version from the systems Path
variable.
You can easily change the value inside System -> Advanced system settings -> environment variables. Inside the Path
variable should be a value like C:\wamp64\bin\php\php5.6.25
. After changing the value a restart is necessary.
You can always find out the currents system PHP version by running php -v
inside the terminal.
© 2022 - 2024 — McMap. All rights reserved.
brew
? – Coenesthesiawhich php
. Did you runphpinfo()
in a web-server or in a cli script? It may be that your web server is pointing to the 5.6.x version, but the cli path still points to the 5.5.x version. – Torytoryism