Knowledge base
  • Goal of knowledge base
  • Linux & core
    • Linux
      • Record SSH session for reporting
      • Compress / Decompress files
      • Colorize logs
      • Cron output & logging
      • Signal
      • Break out and escape SSH session
      • Mount volume permanently
      • Show processes most consuming CPU & MEM
      • Improve and optimize battery life on Linux
      • File ownership & groups in linux
      • Automatic security update/patch on Ubuntu
      • Clean buffers and cached on linux
      • Bash completion on Linux/Mac
    • Core services
      • Nginx reload
      • OpenVPN Split tunneling
      • Nmap commands
    • Hardware
      • CPU Architecture fundamental
  • Database
    • MySQL
      • InnoDB - innodb_file_per_table parameter
      • MySQL - enable slow query log
      • MySQL - export large tables
    • MongoDB
  • Container
    • Docker
      • ADD or COPY in Dockerfile
        • Clean data of docker completely
    • Podman
  • Automation
    • Ansible
      • Output format
  • Build & Deployment
    • Jenkins
      • Jenkins - force exit pipeline when failure
  • Language & Toolset
    • PHP
      • Composer
      • php-redis & php-igbinary
  • Mindset
    • Technical based
      • Writing well
      • Reinvent The Wheel
      • Approach a new system
      • Backup philosophy
      • Mindset for building HA and scalable system
      • GitLab database incident
    • Non-technical based
      • How to read news efficiency?
      • How long should you nap?
      • Assume good faith
  • Reference & learning source
    • Books
      • Sysadmin/SRE
      • Mindsets
      • Software fundamentals
    • English
Powered by GitBook
On this page
  • 0. Introduction
  • 1. Execute composer with specific PHP version
  • 2. Check & find all installed PHP packages
  1. Language & Toolset
  2. PHP

Composer

PreviousPHPNextphp-redis & php-igbinary

Last updated 5 years ago

0. Introduction

composer is a PHP binary script and it's using 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
Unix Shebang