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 :

59 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

      1. Nicolas.jablonski says:

        hello michael,

        does it means that the 1and1 shared hosting are not able to host a laravel installation ? Too much restrictions rights.

        i’m trying to install it without success and i wonder if that’s possible.

        thank you

        1. 1and1help says:

          Unfortunately, I can’t see informations on the Laravel website, which composer or php-cli version you need to install the framework by your own. If it’s running with PHP 5.5 on the command line, it might work.

          Newer php-cli versions are planned for the future, but currently we can’t give you an ETA.

          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

  16. Mark says:

    I am trying to install composer with PHP 5.6> but Icant, are there any solution about this ? cos in admin panel is seems I have php 7. I dont undesrtand why I can use in ssh other php version this does not have logic

    1. 1and1help says:

      Hi Mark,

      I am sorry, but at the moment there is no workaround for this in our webhosting packages. Our dev team is still working on updates for php-cli. There is no ETA for it yet. We’ll keep all users updated on that subject in the future.

      Best regards,
      Michael, 1&1

  17. Robert Riso says:

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

    returns these errors:
    bash: /usr/bin/php5.5-cli: No such file or directory
    curl: (77) Problem with the SSL CA cert (path? access rights?)

  18. Robert Riso says:

    I got past the problem I reported – however, I have another:

    I’m running PHP7.0.21 for this website, but when I check the version in putty I get 5.3.3, and cannot install the Google API client library, which requires 5.4. How/where do I upgrade to 5.4 or better for the command line?

    1. 1and1help says:

      On command line you have to extend your php command to the following path:

      /usr/bin/php5.5-cli

      PHP 5.5 is currently the latest PHP version we offer on the command line.

      Best regards,
      Michael, 1&1

      1. Robert Riso says:

        /usr/bin/php5.5-cli is an empty directory. There is no php interpreter or symbolic link there.

        1. 1and1help says:

          Sorry for the irritation. We are not talking about shared hosting but your own root server? In this case you might have to define the default PHP version on your webserver. If you are using Plesk to configure your server applications, this link might help: https://support.plesk.com/hc/en-us/articles/213949705-Multiple-PHP-Versions-in-Plesk-12-and-higher-Out-of-the-Box

          Best regards,
          Michael, 1&1

  19. Bernard says:

    i have a problem when a using php in command line with ssh,
    please i want to set php in php6 by default!how can i do?

    1. 1and1help says:

      Hi Bernard,

      PHP 6 was planned but never released. In the end, they rolled out PHP 5.4 instead. You would have to use the path like this:

      /usr/bin/php5.4-cli

      The next step would be PHP 7, which we dont support for CLI yet (latest version on our shared servers: /usr/bin/php5.5-cli). We plan to update the versions in the future, but no ETA for this yet.

      Best regards,
      Michael, 1&1

  20. Hi,
    It’s been so long that I can’t update my website with *composer* due to PHP version problem. I select php7 but in console I can not find php7.
    What happen ?

    1. 1and1help says:

      Hi,

      you can find the reason for this here: https://community.1and1.com/using-php-composer-at-1and1/#comment-183940

      This is the current status, our IT is working on updates for the future.

      Best regards,
      Michael, 1&1

  21. Alexis Petithomme says:

    Hi,
    I try to launch a crontab with php but the best I obtain is “Installed PHP Version is too old! Required minimum version is PHP 5.6 (Installed: 5.4.45)”.
    This cron job is used to send notifications, I cannot work without these.
    Have you any solution ?
    The best I have for now is to move to another hosting service…

    1. 1and1help says:

      Hi Alexis,

      in the current situation, php for command line is only installed up to php5.5-cli.

      Maybe a workaround could be to open the file in your cron via curl or wget.

      Best regards,
      Michael, 1&1

      1. Alexis Petithomme says:

        Thank you for your answer but I don’t know how to open a yii file with wget. The command line I have to install is “30 * * * * /path/to/humhub/protected/yii cron/hourly”
        I don’t know how to send a parameter to yii with wget…
        Can you help me ?
        Alexis.

        1. 1and1help says:

          Sorry, we have no experience with Yii. Maybe you might ask the Yii developers if there is a workaround to run this with curl or wget.

          Michael, 1&1

  22. Howie says:

    I too would like to access the command line version of PHP 5.6 (php5.6-cli) via SSH on my shared 1&1 host.
    What is strange to me is that php5.6-cli seems to exist in a web server context but not in an SSH context.
    I configured my website through the 1&1 Control Panel to use PHP version 5.6.
    On my website, I have a webpage consisting of this PHP code:
    <?php
    echo '’ . `hostname -f; ls -l /usr/bin | grep php` . ”;
    ?>
    The result shows php5.6-cli:
    infong797.perfora.net
    lrwxrwxrwx 4 root root 21 Jul 31 09:03 php -> ../lib/cgi-bin/php5.6
    -rwxr-xr-x 4 root root 4190 Jul 31 09:03 php-config5.6
    lrwxrwxrwx 4 root root 21 Jul 31 09:03 php5.6 -> ../lib/cgi-bin/php5.6
    -rwxr-xr-x 4 root root 13455728 Jul 31 09:03 php5.6-cli
    -rwxr-xr-x 4 root root 4495 Jul 31 09:03 phpize5.6

    When I log into my server using SSH and run the same command (hostname -f; ls -l /usr/bin | grep php), it shows the same hostname but it only shows older versions of PHP:
    infong797.perfora.net

    lrwxrwxrwx 4 root root 6 Feb 28 2017 php4 -> php4.4
    lrwxrwxrwx 4 root root 21 Feb 28 2017 php4.4 -> ../lib/cgi-bin/php4.4
    -rwxr-xr-x 8 root root 4502656 Feb 28 2017 php4.4-cli
    lrwxrwxrwx 4 root root 6 Mar 1 2017 php5 -> php5.2
    lrwxrwxrwx 4 root root 21 Mar 1 2017 php5.2 -> ../lib/cgi-bin/php5.2
    -rwxr-xr-x 8 root root 8307384 Mar 1 2017 php5.2-cli
    lrwxrwxrwx 4 root root 21 Mar 1 2017 php5.4 -> ../lib/cgi-bin/php5.4
    -rwxr-xr-x 12 root root 12662384 Mar 1 2017 php5.4-cli
    lrwxrwxrwx 4 root root 21 Mar 1 2017 php5.5 -> ../lib/cgi-bin/php5.5
    -rwxr-xr-x 12 root root 13201840 Mar 1 2017 php5.5-cli
    lrwxrwxrwx 4 root root 21 Mar 1 2017 php6 -> ../lib/cgi-bin/php5.4

    Does anyone know how 1&1 is able to show one set of (old) PHP binaries in SSH context and a different set of (new) PHP binaries in web server context? I think understanding that may give us a way to access php5.6-cli (along with the CLI versions of PHP 7+).

    Thanks,
    Howie

    1. 1and1help says:

      Hi Howie,

      we are talking about 2 different environments for PHP. The old versions for CLI are from an older enviroment which is not connected to the new one which allows you to define PHP for the web browser per domain. Our developers are working on functionalities to combine these two worlds – and ensure up to date php-cli versions also for the future.

      In the mean time, this workaround might work for you: https://mr42.me/art13

      Best regards,
      Michael, 1&1

      1. Johan says:

        I am happy to see my work is being appreciated by 1&1 as well 🙂

        I will provide updates to the PHP 7 binaries until 1&1 has their PHP 7 CLI setup working. At least now there is a workaround for those in need.

        1. 1and1help says:

          Thanks Johan! In fact, we appreciate it very much. 🙂

      2. Howie says:

        Hello Michael,
        I see that the command line version of PHP 7.0 has been added in the past week for 1&1 shared hosting. Thank you!

        Howie

        —-

        > ls -ltr /usr/bin | grep php

        lrwxrwxrwx 2 root root 21 Sep 4 04:32 php7.0 -> ../lib/cgi-bin/php7.0
        -rwxr-xr-x 5 root root 13774384 Sep 4 04:32 php7.0-cli

        1. 1and1help says:

          Hi Howie,

          true – our developers surprised us with that last Friday 🙂

          More versions will follow in the future.

          Best regards,
          Michael, 1&1

  23. Stefan Schreck says:

    FANTASTIC.
    Great news.
    Thanks

  24. Amer says:

    Hi Michael

    We have a 1&1 Performance M, Managed Server in place.

    We recently hired a freelance developer to update one of our websites significantly. He has written all the code on his own (non 1&1) test server and has now said that he needs Git and Composer on our server for his software to work.

    We understand we could switch to a non-manager server and he can install these, but since we do not have a retained IT staff we are very reluctant to go to a non-managed solution as we will not be able to update and protect on a regular basis.

    Can you please suggest what alternative solutions we have?

    Regards

    Amer

    1. 1and1help says:

      Hi Amer,

      you (or your developer) should be able to install Composer on the Managed Server.. We upgrated to /usr/bin/php7.1 in the last weeks, so the latest stable composer version should run now on your system.

      Git is availabe on your server as well. So as far as you don’t need to run commands or configure values which only the root user can run, the software should work on your Managed Server.

      Best regards,
      Michael, 1&1

  25. Tom says:

    Hi, I noticed that someone commented that command line php7 is now available, could you let me know how I can use this please. in Control Panel I have the PHP version set to 7, however in the command line my version is showing as 4.4.9 – I can use php5.5, however I need a higher version for what I need to do.
    All help greatly appreciated.
    Tom

    1. 1and1help says:

      Hi Tom,

      as the latest CLI version we are offering PHP 7.1 right now. For now, this has nothing to do with the version you chose in the Control Panel.

      If you try to run php commands via CLI, the default version for “php” is 4.4.9.

      To address PHP 7.1 for CLI, you have to configure your script, application or cronjob with the concrete path, e.g.:

      /usr/bin/php7.1
      /usr/bin/php7.1

      Best regards,
      Michael, 1&1

      1. Tom says:

        Thank you Michael. 🙂

Leave a Reply

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