Open In App

How to Install PHP Composer on cPanel?

Improve
Improve
Like Article
Like
Save
Share
Report

cPanel is a web hosting management system. cPanel provides a control panel that provides a nice user interface. It is the most reliable & site management system. Moreover, cPanel provides a dashboard where some web date files and MySQL files are present to help others out. A composer is a tool that is used for dependency management in PHP. But Composer is not a package manager. Composer allows adding require project libraries to a certain project. It is used to download required packages for some projects. For installing Composer in cPanel, the machine should have cPanel installed previously.

Features:

  • Composer is used to enabling the declaration of the libraries which are needed for a certain project.
  • According to the project, Composer finds out the proper version of the package & automatically installs it in the project.
  • Using Composer individuals can update all dependencies all at a time in one command.

Installing PHP Composer on cPanel

Follow the following steps to install PHP Composer on cPanel:

Step 1: First, the terminal of cPanel should be opened. In the terminal copy the following commands. It should be pasted at once. After pasting the commands, click enter to run the commands. These commands will download & install the Composer. According to the machine configuration, a proper Composer version will be installed. Wait for some time for the process’s completion. It will take some time.

php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
 

php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
 

php composer-setup.php

Open-terminal-of-cPanel

 

Step 2: Then the following commands should be used. These commands will extract the installation and configure the Composer automatically.

php -r “unlink(‘composer-setup.php’);”

ll

Extracting-the-installation-and-configuration-of-the-Composer

 

Step 3: Now, the Composer has been successfully installed. After the installation, the below commands should be used. These will provide the output of the installed version of Composer. The first command will move into the installed location. The second command will generate the version of Composer. Hence, the installation is successful.

mv composer.phar icomposer

icomposer –version

Composer-has-been-successfully-installed

 


Last Updated : 13 Apr, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads