Composer

0. Introduction

composer is a PHP binary script and it's using Unix Shebang to define which interpreter for executing.
1
[email protected]:~# head /usr/local/bin/composer -n 5
2
3
#!/usr/bin/env php
4
<?php
5
/*
6
* This file is part of Composer.
7
*
8
9
10
/usr/bin/php7.1 /usr/local/bin/composer update
Copied!

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:
1
[email protected]:~# /usr/bin/php7.1 /usr/local/bin/composer update
Copied!
Or just
1
[email protected]:~# php7.1 /usr/local/bin/composer
2
[email protected]:~# php7.2 /usr/local/bin/composer
3
[email protected]:~# php7.3 composer
4
...
Copied!

2. Check & find all installed PHP packages

1
[email protected]:~# ls /usr/bin/ | grep php
2
php
3
php5.6
4
php7.1
5
php7.2
6
php7.3
7
php-config
8
php-config7.1
9
phpdbg
10
phpdbg5.6
11
phpize
12
phpize7.1
Copied!
Last modified 2yr ago