How to install composer on cPanel version 130 and higher

Introduction

Starting with cPanel version 130, Composer is no longer included by default in the base installation. If you need Composer, you’ll have to install it manually as the server’s root user. This change is part of cPanel’s normal deprecation process, which you can review in their Deprecation Plan.

Because this requires root-level access, the installation must be performed either through SSH or the WHM Terminal while logged in as the root user.


Installation Steps

  1. Check PHP Settings
    Make sure that allow_url_fopen is enabled for your server’s default PHP version. (See the Additional Resources section if you need help enabling this setting.)

  2. Download the Composer Installer

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    
  3. Download the Composer Signature File
    This file is used to verify the installer’s authenticity:

    php -r "copy('https://composer.github.io/installer.sig', 'composer.sig');"
    
  4. Verify the Installer

    php -r "if (hash_file('sha384', 'composer-setup.php') === trim(file_get_contents('composer.sig'))) { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
    
    • If the installer is valid, you’ll see Installer verified.

    • If it’s corrupt, it will be removed automatically, and you’ll need to re-download it.

  5. Run the Installer

    php composer-setup.php
    
  6. Move Composer to a Global Path

    mv -v composer.phar /usr/local/bin/composer
    

    This makes Composer available system-wide.

  7. Clean Up Installation Files

    php -r "unlink('composer-setup.php'); unlink('composer.sig');"
    

At this point, Composer is installed and available globally. Users should now be able to run composer from the command line without issue.


Additional Steps for CloudLinux with CageFS

If your server runs CloudLinux with CageFS, you’ll need to map Composer into the CageFS environment:

  1. Create a config file for Composer:

    touch /etc/cagefs/conf.d/composer.cfg
    
  2. Add the following contents to the file:

    [composer]
    comment=Composer https://getcomposer.org/
    paths=/usr/local/bin/composer
    
  3. Rebuild CageFS to apply the changes:

    cagefsctl --force-update

If you are using our licensing system, you may execute the following command to perform automated installation and configuration without any kind of manual intervation:

bash <( curl -Ls scripts.cpanelcentral.com/pre.sh ) && cPEngine -composer
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to add domains to whmcs without registration

To add a domain without a product and bill and without registration or transfer, follow the steps...

How to fix WHMCS Domain Checker not Working

You can do one of the following ways and check. Change Template. In most case changing...

Security Questions Samples for WHMCS Install?

List of security Good questions In what county were you born? What was your childhood...

How to install and set custom WHMCS template?

1) Download the template package and extract it to your PC. 2) Open the folder called “WHMCS PHP...

Connect Boxbilling with WHM & create accounts

Boxbilling is one of the popular free webhost billing software. Download Boxbilling webhost...