Composer

0. Introduction

composer is a PHP binary script and it's using Unix Shebang to define which interpreter for executing.

root@home:~# head /usr/local/bin/composer -n 5

#!/usr/bin/env php
<?php
/*
 * This file is part of Composer.
 *


/usr/bin/php7.1 /usr/local/bin/composer update

1. Execute composer with specific PHP version

So if you're running composer without any specific option, it will use your PHP version at /usr/bin/env php (which is your default PHP)

We can have many versions of PHP inside your Linux and you can flexible use which PHP version for executing as you want like this way:

root@home:~# /usr/bin/php7.1 /usr/local/bin/composer update

Or just

root@home:~# php7.1 /usr/local/bin/composer
root@home:~# php7.2 /usr/local/bin/composer
root@home:~# php7.3 composer
...

2. Check & find all installed PHP packages

root@home:~# ls /usr/bin/ | grep php
php
php5.6
php7.1
php7.2
php7.3
php-config
php-config7.1
phpdbg
phpdbg5.6
phpize
phpize7.1

Last updated