Knowledgebase Home / How to Install Composer on Shared Servers
// View Comments //

How to Install Composer on Shared Servers

Composer helps in managing dependencies in PHP. You can declare the libraries your project depends on, and it helps in managing (install/update) them for you. Composer isn’t a package manager similar to Yum or Apt. It works with ‘packages’ or libraries, but manages them on a per-project basis, installing them in a directory (e.g., vendor) within your project. Nothing will be installed globally by default. Composer enables you to manage dependencies for each project independently. Hence, it is a dependency manager.

Installing composer

To install composer, follow these steps:

  1. SSH access should be enabled for your hosting account with us.
  2. To access your account via SSH, download and install one of the available SSH clients.(like puTTy/Xshell) You can find the list of free SSH clients here or For a cPanel account you can access shell access via ADVANCED >> Terminal

  1. Composer requires PHP 5.5+ version, so we need to check whether the needed version is set up. Type the php -v command in PuTTY (or in Terminal) and you will get the following output
  2. If you need to change PHP version, log in to your cPanel, navigate to the Software and Services section >> Select PHP Version menu. For more details refer to the link: https://www.veerotech.net/kb/php-version-selector-change-php-version/PLEASE NOTE: Composer requires allow_url_fopen. It is enabled by default for all PHP versions on our Shared servers. Still, you may check if it is On by going to ‘Options’ Settings in the Select PHP version menu.
  3. Next, navigate to the folder you want to install Composer in. In our example, we will install Composer in the ‘newdomain.com‘ folder.
    cd newdomain.com
  4. When all the preparations are done, you are ready to install Composer. Open the PuTTY window/terminal where you have logged into your cPanel account and fill in the following command.
    php -r “readfile(‘https://getcomposer.org/installer’);” | php -c php.ini
    or to download the composer installer, type the following commands.

    cd newdomain.com

    curl -k -O https://getcomposer.org/installerTo install composer, type the following command.php -d allow_url_fopen=On installerThis will execute the Composer installation
  5. To confirm the composer is installed correctly, type the following command.
    php composer.phar -V The composer should display the version number.
  6. To update the composer installation to the newest version in the future, type the following command:
    php composer.phar self-update 
  7. To run composer commands use:
    php composer.phar

    In case you get a notification Some settings on your machine make Composer unable to work properly, make sure that the PHP version is 5.5 or higher.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments