Using PHP Composer in the IONOS Web Hosting Packages

2 Replies • Leave your reply

PHP Composer (Composer) is a so-called "dependency management tool," which makes it possible for you to comfortably reference and keep up-to-date the external sources and libraries in your own PHP projects.

Many open source projects now no longer supply any ZIP archives or other installation packages – but reference the respective GitHub repositories.

To use Composer in the 1&1 IONOS Web Hosting and Performance Hosting packages, you must know that Composer is not installed by default, that it is a small PHP script, which requires a PHP interpreter. However, 1&1 IONOS offers a variety of current PHP versions – which can be set for each domain.

By default, Composer will however not be called in the web browser, but via the so-called shell or console.

Note: In almost all 1&1 IONOS packages, shell access via SSH is possible. If your package does not support SSH access, you should best change to the next higher one, because Composer itself requires more resources.

To use Composer in your 1&1 IONOS Web Hosting package, please log in via SSH and execute the following steps – should you have any questions, insert them as comments at the end of the article:

Download Composer:

curl -sS https://getcomposer.org/installer | /usr/bin/php5.5-cli

Then, a composer.phar file is available in your webspace. If you call the composer.phar directly, you will get an error because Composer will not automatically find the correct PHP version.

Start Composer for the first time:

/usr/bin/php5.5-cli composer.phar

As a result, you get an overview of all the Composer “commands”:

Composer

To always use the latest Composer version, use for example the following command:

/usr/bin/php5.5-cli composer.phar selfupdate

Important note:

The path to PHP-CLI in the above example depends on the version and may change!

We look forward to your feedback! Have you already been using Composer?