Source: http://www.zkbhj.com/articles/?id=3863
We can install the Composer through the Composer image, before you make sure that PHP is already installed on your machine and that you can execute commands via PHP. If you have a full path to execute (/usr/local/php/bin/php) on your server, you can change it by using the following command:
cp/usr/local/php/bin/php/usr/sbin/
This way, you can do it through "PHP".
First, the local installation
The partial installation is to install composer under the current directory (such as installing to the project root), and then you can use the composer with PHP Composer.phar.
Mac or Linux system: open a command-line window and execute the following command:
curl -sS http://install.phpcomposer.com/installer | php
Windows Systems (MAC or Linux systems are also available): Please execute the following command:
Php-r "ReadFile (' Http://install.phpcomposer.com/installer ');" | Php
Second, the global installation:
The global installation is to install composer PATH
under the path contained in the system environment variable, and then execute the command directly in the command composer
-line window.
Mac or Linux system: Open a command-line window and execute the following command:
Curl-ss Http://install.phpcomposer.com/installer | sudo php----install-dir=/usr/local/bin--filename=composer
Windows system: On the command line, execute the following command:
mkdir C:\bin
cd C:\binphp -r "readfile(‘http://install.phpcomposer.com/installer‘);" | phpecho @php "%~dp0composer.phar" %*>composer.bat
Once the above command executes successfully, add the path to the C:\bin
PATH
environment variable. Finally reopen a command-line window and try the execution composer --version
to see if the version number is correctly output, for example:.
Composer version 1.0-dev (CD21505C8D58499A9B4D38573881CFEC49C51FFD) 2016-01-27 13:04:22
Third, the image description:
When installed through the official channels, the composer
default is to https
download files from the Web site by agreement, getcomposer.org
but the composer.phar
installation process is painful for well-known reasons.
"Composer China Mirror" is the Composer source code based on the recompilation of composer.phar
files, and through the domestic CDN to accelerate the download. In addition, in order to ensure the use of the latest version of the composer, developers need to frequently execute composer selfupdate
commands to update the composer, so we will composer update source is also replaced by this image, so that the entire composer of the use of the process more comfortable!
Tip: Don't forget to do it often composer selfupdate
to keep composer always the latest version Oh!
How to install composer on Linux