Installing Composer on cPanel servers
- Composer 101
- Installing Composer on cPanel servers
- Working with Composer & Examples
With a tool like Composer it is generally best to have the ability to run it as any user on the server and from any directory. This is generally referred to as being 'globally installed' as any user can access the tool from any location. In this guide we will detail how to install Composer globally on a cPanel based server.
Pre-Flight Check
- These instructions are intended specifically for installing Composer on a cPanel based server running WHM prior to version 58.
- We'll be logging in as root to a Liquid Web Fully Managed cPanel server.
For more details see: What's New in WHM 58 & What to Look For
Step #1: Get the installer
Acquire the Composer installer script with the following commands:
EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$EXPECTED_SIGNATURE') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
The above commands will: get the installer's signature, get the installer file, verify the download by checking the signature and finally confirm if the installer is valid, or corrupt. You should see output similar to:
Step #2: Run the installer
To run the installer in a manner that will install composer globally run the following command:php ./composer-setup.php --install-dir=/usr/local/bin --filename=composer
With this command run as root composer should now be globally installed on the server.
Step #3: Verify the install
In order to verify the composer installation was successfully you will want to do the following to test. First, as root, run the following command:# composer -V
You should see something similar to:
If that checks out, you will then want to verify Composer works for the users as well. To confirm composer is working for the cPanel accounts SSH into your server as a cPanel user and do the same:
$ composer -V
You should see something similar to:
Related Articles:
- How to Use Disk Quotas in Dedicated Linux Servers With cPanel
- How to Use Disk Quotas in Dedicated Linux Servers with Plesk
- Remove a MySQL User on Linux via Command Line
- Remove Permissions for a MySQL User on Linux via Command Line
- Grant Permissions to a MySQL User on Linux via Command Line
- Using MySQL Command Line to Create a User

About the Author: David Singer
I am a g33k, Linux blogger, developer, student, and former Tech Writer for Liquidweb.com. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
How to Install Adminer MySQL Database Management Tool on AlmaLinux
Read ArticleWhat is CGI-Bin and What Does it Do?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article