Using PHP Composer in the 1&1 Web Hosting Packages

PHP Composer (Composer) is a so-called „dependency management tool“, which makes 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 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 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 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 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:

    1. 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.

    2. 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

    3. 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?

 

Please rate this post :

30 thoughts on “Using PHP Composer in the 1&1 Web Hosting Packages

  1. Kate Davis says:

    Next week, we will tell you how to use Composer at 1&1, e.g. when installing the CMS Typo3 NEOS.

    Please do the above as I keep hitting errors on the install!

    1. Philipp Bellmann says:

      Hey Kate,

      we will start work on the NEOS guide later than expected. We know that getting NEOS up and running is not trivial, so we want to provide a thourough guide, once we release it. Thanks for your patience.
      Phil

  2. Kate Davis says:

    I am trying to install Neos on a 1and1 site and could do with getting past the failing install screen.
    I use SSH to do the Composer aspect. I change flow.bat, Setting.yaml and although phpinfo can find php version and php.ini, the Neos install aspect cannot work out anything.

    I have quite happily installed it under Mamp on my Mac. My brain is totally confused and completely embarrassed, please help?

  3. Lui says:

    What to do when we have a composer out of memory error while running composer update?

    1. Ness says:

      I have the same problem

  4. mark says:

    Ive got composer installed and want to add the Amazon API to it but keep getting this error even though Im referencing PHP6? How do I force it to use PHP6?

    exeu/apai-io 2.0.0 requires php >=5.6.0 -> your PHP version (5.4.45) does not satisfy that requirement.

    1. 1and1help says:

      Hi mark,

      in our history of PHP versions over the last years, PHP6 is in fact PHP 5.4 (the PHP community had plans for PHP 6, but dropped them and released 5.5, 5.6 and as a next step 7.0 instead).

      For usage via shell commands we are not offering more than php5.5 yet. Will be updated in the future, but no ETA for it yet, sorry.

      Michael, 1&1

  5. Diego says:

    I don’t understand why we must use php 5.6 or php 7 in our hosting but can’t use in ssh console.
    You must offer php 5.6 or php 7 soon as posible because a lot of modules in compose need php 5.6 or more.
    Diego.

    1. 1and1help says:

      Hi Diego,

      we are aware of that. Our developers are working on updates with high priority at the moment. As soon as we have concrete informations to share, we will let you know.

      Thanks for your patience,
      Michael, 1&1

  6. Rob says:

    Will 1&1 support installing Laravel and other more up to date frame works (mean stack stuff, etc)? If it does can you point to how to work within 1&1 to install/access it. IF not, why? and when, if at all, do you plan on getting this stuff updated to support these types of technologies?

    thanks!

    1. 1and1help says:

      Hi Rob,

      I am sorry, we have no plans to pre-install Laravel or other up-to-date frameworks on our shared hosting in the near future.

      If you are web developer, you might want to try out the 1&1 Cloud Severs (root version) as an alternative to a classic hosting package: https://www.1and1.com/dynamic-cloud-server

      Best regards,
      Michael, 1&1

  7. Orlando says:

    Hi,the console show me PHP 4.4.9 (cgi-fcgi) (built: Feb 28 2017 11:31:58), how can I change it to PHP 5.6 CLI, because php-cgi does not support -S , thanks!

    1. 1and1help says:

      Hi Orlando,

      this is still the current status: https://community.1and1.com/using-php-composer-at-1and1/#comment-178189

      The latest version you can get with us at the moment is php5.5-cli.

      Best regards,
      Michael, 1&1

  8. Andreas Anding says:

    When can we use PHP 7 on Command Line?

    1. 1and1help says:

      Hi Andreas,

      this is still the current status:

      https://community.1and1.com/using-php-composer-at-1and1/#comment-181374

      Best,
      Michael, 1&1

  9. Steve says:

    I have php7 installed now, but composer gives me the error: requires php >=5.6.0 -> your PHP version (5.4.45) does not satisfy that requirement. How can I force composer to use php7?

    1. 1and1help says:

      Hi Steve,

      at the moment the PHP versions you can use with us differ between browser commandos via http/s and the version you can use via command line.

      For command line scripts (and cronjobs as well) we only offer PHP up to PHP 5.5 (php5.5-cli).

      Regarding plans for updates, please read here: https://community.1and1.com/using-php-composer-at-1and1/#comment-178189

      Best,
      Michael, 1&1

  10. Russ says:

    This lack of php 5.6 or php 7 support on the command line is appalling. When are you going to fix it?

  11. 1and1help says:

    Hi Russ,

    It’s definitely on our agenda, but no final ETA yet, sorry.

    Best regards,
    Michael, 1&1

  12. Marouane says:

    Just run one commande to install PHP5.6,
    We are waiting to fix this problem

    1. 1and1help says:

      Hi,

      that might be true if you are running PHP on your own single root server. Our shared hosting infrastructure is much more complex than that, so running one simple command is unfortunately not enough. Updating the PHP versions has to be planned very carefully by our admins. That’s whats happening at the moment. They are working hard to deliver newer versions as soon as possible.

      Best regards,
      Michael, 1&1

  13. Cristian says:

    Hi, I have installed on my hosting site the php composer, but once the page is launched from the browser it says the following error despite the path is correct “Fatal error: require_once(): Failed opening required ‘../vendor/autoload.php’ (include_path=’.:/usr/lib/php5.6′)”, why – how can i fix it? Thanks in advance

    1. 1and1help says:

      Hi Cristian,

      this is the reason for the error message – and still the current status: https://community.1and1.com/using-php-composer-at-1and1/#comment-183885

      Best regards,
      Michael, 1&1

      1. Cristian says:

        Ok but i how to fix it, i can not wait, i have moved the domain to have better services but i always find myself at the same point!

      2. Cristian says:

        Ok Then since I bought your hosting for more services I have to tell you I have to wait? I can not wait for you to create a disservice

        1. 1and1help says:

          Hi Cristian,

          at the moment there is no way to fix this in our shared hosting packages. As soon as we are rolling out updates to our servers, you should be able to use the latest composer versions.

          For now, maybe another hosting product would be a better solution for you. Don’t hesitate to contact us for a consultation: https://contact.1and1.com/

          Best regards,
          Michael, 1&1

  14. Edmon says:

    Hi!

    After running successfully the commands you show in this tutorial, when I type the composer command, the message

    -bash: composer: command not found

    appears.

    Anything else I should do to have it?

    Thanks!

    1. Edmon says:

      Oh, got it , I should always use

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

      Right?

  15. Femi says:

    I have Php 7.0 install on my 1&1 Basic contract and I used mysql_connect() in my project. I have check the php setting on my CP but no version 5.6 or 5.5 there. What can I do to make changes to this version.

    Thanks.

    1. 1and1help says:

      Hi Femi,

      we still offer PHP 5.6 in the PHP settings of your contract free of charge.

      If you want to use PHP 5.5, we can activate the PHP 5.5 Extended Support with an additional monthly fee for you. If you are interested in this, just e-mail us for further informations: help@1and1.com

      Best regards,
      Michael, 1&1

Leave a Reply

Your email address will not be published. Required fields are marked *