How to Install PHP Composer on a Linux Server?
Posted on December 5th, 2017
How to Install PHP Composer on a Linux Server?
There are many programming languages available for building complex web applications. PHP is one of the most widely used programming languages among them. All applications require certain dependencies to be installed on the server for working. Sometimes the developers may find it difficult to manage all the dependencies required when building complex web applications. Like other programming languages, PHP can manage web applications dependencies and the required libraries by using Composer.
Composer
The Composer is a package manager for PHP programming language which can be used in application level. The PHP developers all over the world use PHP Composer to manage application dependencies. The dependencies for all the PHP packages are installed automatically to reduce the workload of the developers. It is similar to use of npm and bundle for Node.js and Ruby respectively. PHP composer also provides features to install all applications which are listed at https://packagist.org/.
Installation
In this tutorial, you will learn how to install PHP Composer on a Linux server. Before we start the steps, ensure that you have root access to the server. You must be connecting to the server via SSH before proceeding any further. Please refer https://www.interserver.net/tips/kb/using-putty-to-ssh-to-server/ , if you are using a windows system to connect to the Linux server. Putty is an SSH client program and it is very easy and simple to use.
1) The installation of Composer on a Linux server is simple and straightforward. All you have to do is download and install the Composer by executing the following command:
curl -sS https://getcomposer.org/installer | php
The installation may require a few seconds to complete.
2) You need to make the ‘composer.phar’ file executable by running the following command :
chmod +x composer.phar
3) Run the following command to make Composer globally available for all system users:
mv composer.phar /usr/local/bin/composer
4) That’s it! You have now installed Composer on your Linux server and made it globally available for all users. You can verify the installation by checking Composer version. Run the following command to confirm the Composer installation.
composer -V
You should get a similar output:
Composer version 1.4.2-dev (7a9eb02190d334513e99a479510f87eed18cf958) 2017-08-11 11:10:33
You don’t have to search manually for dependencies for the PHP projects developed on your Linux server. You can now use Composer to install required PHP dependencies on your server. The Composer also updates packages by upgrading dependencies to the latest version.
If you need any further assistance, please contact support.