BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Set up PHP Composer in WHM?

Posted by Allura on 22 01 2019.

PHP’s sole package manager and dependency is the composer. The user’s cPanel account ought to possess SSH access for using the composer. The composer’s role is also to provide a conventional format of PHP software and the other required libraries.

For using composer, one should install the numerous PHP modules and also verify that the server’s php.ini file has been configured properly. This file is essential for the proper running of the composer. By default, when the composer is called- it makes use of the server’s php.ini file solely.

Let’s take a look at the required PHP modules necessary for setting up composer in WHM:

Make sure the several PHP modules are enabled in Easy Apache. Some of them are enlisted below-

 	Phar- It offers a way for storing all kinds of PHP applications into a singular ‘phar’ file, also known as PHP Archive. This is done for convenient distribution and installation.
 	Iconv-…

PHP’s sole package manager and dependency is the composer. The user’s cPanel account ought to possess SSH access for using the composer. The composer’s role is also to provide a conventional format of PHP software and the other required libraries.

For using composer, one should install the numerous PHP modules and also verify that the server’s php.ini file has been configured properly. This file is essential for the proper running of the composer. By default, when the composer is called- it makes use of the server’s php.ini file solely.

Let’s take a look at the required PHP modules necessary for setting up composer in WHM:

Make sure the several PHP modules are enabled in Easy Apache. Some of them are enlisted below-

  • Phar- It offers a way for storing all kinds of PHP applications into a singular ‘phar’ file, also known as PHP Archive. This is done for convenient distribution and installation.
  • Iconv- In case you install this module, there is no requirement of the MB string module. Iconv provides a character set conversion.
  • MB string- Likewise, if you install this module, the iconv module will not be required. MB string offers enhanced language support, some of them being Chinese, Japanese etc.

In case you are unable to make alterations in the php.ini file, you have to run a certain command mentioned by the cPanel. In case you use the composer quite often, you can create the Bash alias for performing this command for you. The composer command can be run without any additional options and flags if the alias has been added.

What if you are unable to edit the php.ini file?

In case a user is unable to make manual changes in the php.ini file, a specific command as displayed by the cPanel’s server will have to be run as well.

In case a user receives the ‘command not found’ error message, a proper path to their cPanel account’s .bash_profile file has to be added. If problems are being experienced with the source option itself, click on the PATH option to the .bash_profile file.

The composer of the cPanel consists of a self diagnostic tool which ensures that one has properly and accurately configured the PHP.

There are alternative diagnostic tools which can be used from the account of the Composer’s Github.