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:
- Using MySQL Command Line to Create a User
- 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

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
Best authentication practices for email senders
Read ArticleWhat is SDDC VMware?
Read Article2024 cPanel and Plesk pricing breakdown
Read ArticleCentOS Linux 7 EOL — everything you need to know
Read ArticleHow to install Node.js on Linux (AlmaLinux)
Read Article