composer install using php5.6 instead of php7

PHP 7.x is the recent version of php, in some cases you may want to install application using composer and php56 while your system has php7.x installed on it.

You ‘ll need to install php5.6
on arch linux you can install php 5.6 from aur by using yaourt or any other aur installer.

After you have installed php56 and php56-apache along with other required extensions you have to use composer to install / update dependencies.

Here is the real problem, composer by default run using default php version by choosing /etc/php/php.ini while ini file for php56 is located at /etc/php56/php.ini

To deal with above problem you have to tell composer to use specific version of php and locate the composer install file to install dependencies.

Download composer 1.5.6 from composer official site and place it in your application root and run following command.

$ php56 -d extension=phar.so ./composer.phar install

Composer will now start using php56 with /etc/php56/php.ini and ‘ll install all dependencies.

One thought on “composer install using php5.6 instead of php7

Leave a Reply

Your email address will not be published. Required fields are marked *