You are on page 1of 5

2/1/2021 Installing PHP Composer on CentOS 7

(https://cloudwafer.com/)

 

PHP (/BLOG/TAG/PHP/) CENTOS 7 (/BLOG/TAG/CENTOS-7/) COMPOSER (/BLOG/TAG/COMPOSER/)

Installing PHP Composer on CentOS 7


CloudwaferHQ (/blog/author/cloudwaferhq/) - November 27, 2019

Composer (https://getcomposer.org/) is a tool for dependency management in PHP. It allows


you to declare the libraries your project depends on and it will manage (install/update) them for
you.

Composer is not a package manager in the same sense as Yum or Apt is. Although it deals with
"packages" or libraries, it manages them on a per-project basis, installing them in a directory
(e.g. vendor) inside your project. By default, it does not install anything globally. Thus, it is a
dependency manager.

In this guide, we will install PHP Composer on CentOS 7.

Deploying your cloud server


If you have not already registered with Cloudwafer (https://cloudwafer.com), you should begin
by getting signed up (https://my.cloudwafer.com/?cmd=cloudsignup). Take a moment to create
an account after which you can quickly deploy your cloud servers.

Once you have signed up, log into your Cloudwafer Client Area (https://my.cloudwafer.com/?
cmd=login) with the password provided in your mail and deploy your Cloudwafer
(https://cloudwafer.com) cloud server.

Updating System Packages


It is recommended that you update the system to the latest packages before beginning any
signi cant installations. Issue the command below:

sudo yum update -y

https://cloudwafer.com/blog/installing-php-composer-on-centos-7/ 1/5
2/1/2021 Installing PHP Composer on CentOS 7

Install PHP 7: You can read this guide on installing PHP 7


(https://cloudwafer.com/)
(https://cloudwafer.com/blog/installing-multiple-versions-of-php-on-centos/) on your
CentOS7 server if you don't have PHP 7 installed.

 

Next, install the PHP Command Line Interface package and other dependencies by issuing the
command below:

sudo yum install php-cli php-zip wget unzip

After installing the PHP CLI package, proceed to download the Composer installer script by
issuing the command below:

php -r "copy('https://getcomposer.org/installer (https://getcomposer.org/installe


r)', 'composer-setup.php');"

We can verify the data integrity of the downloaded script by comparing the script SHA-384 hash
with the latest installer hash found on the Composer Public Keys/Signatures page.

Issue the command below:

HASH="$(wget -q -O - https://composer.github.io/installer.sig (https://composer.gi


thub.io/installer.sig))"

Next, issue the command below to verify that the installation script is not corrupted run the
following command:

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Install


er verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } e
cho PHP_EOL;"

Lastly, we can now issue the following command to install Composer in the /usr/local/bin
directory:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer


https://cloudwafer.com/blog/installing-php-composer-on-centos-7/ 2/5
2/1/2021 Installing PHP Composer on CentOS 7

(https://cloudwafer.com/)

 

You can also issue the command "composer" to print Composer’s version, commands, and
arguments as shown below:

You can read the o cial Composer documentation (https://getcomposer.org/doc/) for more
information on Composer.

Share this article

 Facebook  Twitter  Google+


(https://www.facebook.com/sharer/sharer.php?
(https://twitter.com/share?
(https://plus.google.com/share?
u=https://cloudwafer.com/blog/installing-
text=Installing%20PHP%20Composer%20on%20CentOS%207&url=https://cloudwaf
url=https://cloudwafer.com/blog/installing-
php- php- php-
composer-on- composer-on- composer-on-
centos-7/) centos-7/) centos-7/)

(/blog/author/cloudwaferhq/)
CloudwaferHQ (/blog/author/cloudwaferhq/)
 (https://cloudwafer.com/blog/)  (https://twitter.com/cloudwaferhq)
 (https://www.facebook.com/cloudwafer)

PREVIOUS POST (HTTPS://CLOUDWAFER.COM/BLOG/INSTALLING-APACHE-MAVEN-ON-CENTOS-7/)


(https://cloudwafer com/blog/installing-apache-maven-on-centos-7/)
https://cloudwafer.com/blog/installing-php-composer-on-centos-7/ 3/5
2/1/2021 Installing PHP Composer on CentOS 7
(https://cloudwafer.com/blog/installing-apache-maven-on-centos-7/)

(https://cloudwafer.com/)
CENTOS 7 (/BLOG/TAG/CENTOS-7/) APACHE MAVEN (/BLOG/TAG/APACHE-MAVEN/)

Installing Apache Maven on CentOS 7


 
(https://cloudwafer.com/blog/installing-apache-maven-on-
centos-7/)
NEXT POST (HTTPS://CLOUDWAFER.COM/BLOG/INSTALLING-PIP-ON-CENTOS-7/)

(https://cloudwafer.com/blog/installing-pip-on-centos-7/)

PYTHON (/BLOG/TAG/PYTHON/) CENTOS 7 (/BLOG/TAG/CENTOS-7/) PIP (/BLOG/TAG/PIP/)

Installing Pip on CentOS 7


(https://cloudwafer.com/blog/installing-pip-on-centos-7/)

ALSO ON CLOUDWAFER HOSTING

Benefits of Cloud Installing Angular on Installing Python 3 Installing


Computing For … Ubuntu 16.04 on Debian 9 Admin To

2 years ago • 1 comment 2 years ago • 2 comments a year ago • 1 comment 2 years ago • 2
Benefits of Cloud Installing Angular on Install Python on Debian 9 cockpit on ce
Computing For Small Ubuntu 16.04/18.04 how to
Businesses in Nigeria … install angular on …

0 Comments Cloudwafer Hosting 🔒 Disqus' Privacy Policy 


1 Login

 Recommend t Tweet f Share Sort by Best

Start the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

Be the first to comment.

✉ Subscribe d Add Disqus to your siteAdd DisqusAdd ⚠ Do Not Sell My Data

https://cloudwafer.com/blog/installing-php-composer-on-centos-7/ 4/5
2/1/2021 Installing PHP Composer on CentOS 7
COMPANY

Home (https://cloudwafer.com/)
(https://cloudwafer.com/)
About Us (https://cloudwafer.com/about)
Referral Program (https://my.cloudwafer.com/a liates/)
Network Status (https://status.cloudwafer.com/)  

HOSTING PRODUCTS

SMART CLOUD (HTTPS://MY.CLOUDWAFER.COM/CART/CLOUD/) DEDICATED (HTTPS://MY.CLOUDWAFER.COM/CART/DEDICATED/)

WEB HOSTING (HTTPS://MY.CLOUDWAFER.COM/CART/WEB-HOSTING) DOMAIN NAMES (HTTPS://MY.CLOUDWAFER.COM/CART/DOMAINS/)

LICENSES (HTTPS://MY.CLOUDWAFER.COM/CART/LICENSES/) SSL CERTIFICATES (HTTPS://MY.CLOUDWAFER.COM/CART/SSL/)

CLOUD DNS (HTTPS://MY.CLOUDWAFER.COM/CART/CLOUD-DNS/)

SUPPORT

Knowledgebase (https://my.cloudwafer.com/knowledgebase/)
Contact Sales (https://my.cloudwafer.com/tickets/new/)
Submit a Ticket (https://my.cloudwafer.com/tickets/new/)

SUBSCRIBE

Get latest articles

Enter your email... SUBSCRIBE

 (https://facebook.com/cloudwafer)     (https://twitter.com/cloudwaferhq)             (https://cloudwafer.com/blog/rss/)   

Cloudwafer Blog (https://cloudwafer.com/blog) © 2021.       High Performance Cloud Hosting by https://cloudwafer.com (https://cloudwafer.com)

https://cloudwafer.com/blog/installing-php-composer-on-centos-7/ 5/5

You might also like