BuycPanel Blog

BuycPanel Blog

Latest news and updates

Troubleshooting the Composer

Posted by Allison on 06 01 2017.

A PHP dependency and package manager, the Composer enables you to dictate the libraries which all of your project rely on. When you have Composer in your cPanel, it will allow you to manage, including installation and updates, these libraries and projects for you.

The cPanel & WHM developers introduced this management system with version 58.Before you can start using the Composer though, you should have a cPanel account that comes with an SSH access to the server itself.

There are some cases though, wherein you will run into trouble during the installation of the Composer or with the Composer itself. Fortunately, there are various ways to resolve this. Some of the most common errors include the following:

Unable to change the php.ini file

During the installation of Composer on a server that makes use of Suhosin, the user needs to make changes to php.ini file. For instance, you should have the Phar PHP…

A PHP dependency and package manager, the Composer enables you to dictate the libraries which all of your project rely on. When you have Composer in your cPanel, it will allow you to manage, including installation and updates, these libraries and projects for you.

The cPanel & WHM developers introduced this management system with version 58.Before you can start using the Composer though, you should have a cPanel account that comes with an SSH access to the server itself.

There are some cases though, wherein you will run into trouble during the installation of the Composer or with the Composer itself. Fortunately, there are various ways to resolve this. Some of the most common errors include the following:

Unable to change the php.ini file

During the installation of Composer on a server that makes use of Suhosin, the user needs to make changes to php.ini file. For instance, you should have the Phar PHP module added to the whitelist of Suhosin which you will find in the php.ini file of your server.

A common error that happens in this process is the inability to make changes to the php.ini file. In order to address this, manually execute the following command every time you want to use Composer: “php -d allow_url_fopen=1 -d detect_unicode=0 -d suhosin.executor.include.whitelist=phar $” (do not include the quotation marks).

When your server does not run on Suhosin, the manual command you should execute is: “php -d allow_url_fopen=1 -d detect_unicode=0 $ {which composer}” (again, remove the quotation marks).

The “Command not found” Error message

This message affects the Composer itself. When you get this notification, you most likely have to add the correct path to the .bash_profile file of your account. Just add these to .bash_profile file: “source /etc/profile.d/cpanel-php-composer.sh” (get rid of the quotation marks).

When the source option is the one responsible for your troubles, you just have to include “PATH” option to your account’s .bash_profile file. Do this by executing the command: “PATH=$PATH:/opt/cpanel/composer/bin” (again, remove the quotation marks).

In order for these changes to take effect, you should log into your server again.

Using the self-diagnostic tool of the Composer

One of the greatest features of the Composer is that it comes with a self-diagnostic tool. With this utility, you can easily make certain you have correctly configured PHP. To use this self-diagnostic tool, you just have to execute this command: “composer diagnose” (without the quotation marks).

The Composer also has the “Checking platform setting” option responsible for providing feedback and other useful information about the PHP configuration of your servers. In the event that any of your PHP configuration fails, this option will let you know right away.

Using other diagnostic tools

Just in case you need a diagnostic tool aside from the Composer’s self-diagnostic feature, you can simply utilize the one from Composer’s Github account.

In order to make this work, execute this command: “curl https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer | php — –check” (again, do not include the quotation marks).

Keep in mind though, that this tool only checks and reviews the PHP configuration of your server.