Thursday, August 8, 2019

PHP : Install Composer on Centos

1.First install the PHP CLI (command line interface) package and all other dependencies with:
#sudo yum install php-cli php-zip wget unzip
2.Once PHP CLI is installed, download the Composer installer script with:
#php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
3.To verify the data integrity of the script
#HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
4.To verify that the installation script is not corrupted run the following command:
#php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
5.Run the following command to install Composer in the /usr/local/bin directory:
#sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
6.The last step is to verify the installation:
#composer 
______
/ ____/___  ____ ___  ____  ____  ________  _____
/ /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.8.5 2019-04-09 17:46:47

source : https://linuxize.com/post/how-to-install-and-use-composer-on-centos-7/

Related Posts:

0 comments:

Post a Comment