Using PHP Composer in IONOS web hosting packages

PHP Composer (Composer) is a so-called "Dependency Management Tool", which makes it possible to reference external sources and libraries in your own PHP projects comfortably and to keep them up to date.

Many open source projects no longer deliver ZIP archives or other installation packages - but reference the respective GitHub repositories.

To be able to use Composer in 1&1 web hosting and performance hosting packages, you need to know that Composer is not installed by default because it is a small PHP script itself, which requires a PHP interpreter. Therefore, we recommend that you upgrade your PHP version before downloading and running Composer.

Web hosting with a personal consultant!

The host with the most: fast and scalable, including a free domain for one year and an email address. Trust web hosting from IONOS!

Domain
SSL
24/7 support

Download and run PHP Composer

By default, Composer is not called in the Web browser, but via a Secure Shell access (SSH). In the Shell Access (SSH) with PuTTY guide, we describe how many IONOScustomers will proceed in such a case.

Note

Almost all IONOS packages allow shell access via SSH. If your package does not support SSH access, it is best to switch to a different WebHosting contract, as Composer itself requires more resources.

To use Composer in your web IONOS hosting package, please log in via SSH and follow these steps. If you have any questions, please feel free to post them in the discussion of the article. PHP-Composer also offers extensive documentation in English.

Download Composer

curl -sS https://getcomposer.org/installer | /usr/bin/php7.1-cli

After that there is a composer.phar file in your webspace. If you now call composer.phar directly, you will get an error, because Composer does not automatically find the correct PHP version. Therefore, start the Composer for the first time as follows.

Start Composer for the first time

/usr/bin/php7.1-cli composer.phar

As a result, you get an overview of all Composer commands.

To always use the latest Composer version, use e.g. the following command:

/usr/bin/php7.1-cli composer.phar selfupdate
Note

The path to PHP-CLI in the above example is version dependent and may change!


Own your online success
IONOS takes care of your online challenges
Create your website with the perfect domain and the UK's fastest hosting!