1&1 now has native PHP 7.1 CLI support. Continue only if you require PHP 7.0 or 7.2 CLI.

1&1 has been a fairly early adopter to PHP 7 in their Shared Webhosting and provides regular updates to the latest version in every 7.x branch. However, for some reason the latest version available in the shell is a bit behind. This could get you into trouble, for example when using composer, where your desired package has a requirement higher than the version available. This article delivers a solution.

Login to your environment with ssh and follow these steps:

  • PHP 7.0.29

    wget --content-disposition https://mr42.me/dl/php70
    tar xjf php70.tar.bz2
    echo "alias php='LD_LIBRARY_PATH=~/bin/lib ~/bin/php70-cli'" >> ~/.bashrc
  • PHP 7.2.4

    wget --content-disposition https://mr42.me/dl/php72
    tar xjf php72.tar.bz2
    echo "alias php='LD_LIBRARY_PATH=~/bin/lib ~/bin/php72-cli'" >> ~/.bashrc

You can either log out and log back in, or run . ~/.bashrc in order to run php on the command line.

permalink · 1 comment · linux, PHP, 1&1 · · updated · Johan