Reputation: 7677
im having issues to install laravel under my server running php 5.3 by default BUT i'm able to pick a version of php to run under any specific directory.
guzzlehttp/guzzle 4.1.2 requires php >=5.4.0 -> your PHP version does not satisfy that requirement.
so i choose php 5.4 to run on the directory that im trying to install laravel, but composer do not know that im running PHP 5.4 in that directory.
How to fix this problem?
Upvotes: 5
Views: 12343
Reputation: 490
This might help some... composer is likely to be using /usr/bin/php, consider the following:-
$ which php
/usr/bin/php
$ /usr/bin/php -v
PHP 7.1.33
$ php -v
PHP 7.2.24
$ type -a php
php is aliased to '/usr/bin/php7.2'
php is /usr/bin/php
$ which composer
/usr/local/bin/composer
As you can see our hosting has an alias to ensure the configured version of php (for webserver) is used on command line. But composer is configured to use /usr/bin/php.
The following is a workaround for the above circumstance.
Update .bash_aliases file
alias php="/usr/bin/php7.2"
alias composer="/usr/bin/php7.2 /usr/local/bin/composer"
Once logged out of terminal and logged back in...
$ type -a composer
composer is aliased to '/usr/bin/php7.2 /usr/local/bin/composer'
composer is /usr/local/bin/composer
composer is now using the correct php version.
Upvotes: 1
Reputation: 1390
When you execute composer install/update
it runs with your default PHP version of your machine.
To make it work with specific versions (that's example path on my Mac) please change it with your executable php path.
/usr/local/Cellar/php71/7.1.8_20/bin/php composer.phar install
Upvotes: 2
Reputation: 166319
Try running composer
command with --ignore-platform-reqs
, e.g.
composer install --ignore-platform-reqs
Upvotes: 15