PHP 7.4.16 & 8.0.3 for 1&1 IONOS
Since I moved away from 1&1 IONOS, updates will be irregular!
1&1 IONOS 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 runnning 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:
-
wget --content-disposition https://mr42.me/dl/php74 tar xjf php74.tar.bz2 echo "alias php='LD_LIBRARY_PATH=~/bin/lib ~/bin/php74-cli'" >> ~/.bashrc
-
wget --content-disposition https://mr42.me/dl/php80 tar xjf php80.tar.bz2 echo "alias php='LD_LIBRARY_PATH=~/bin/lib ~/bin/php80-cli'" >> ~/.bashrc
You can either log out and log back in, or run . ~/.bashrc
in order to run php
on the command line.
It is also possible to use this PHP version in your cronjobs, after adding 2 lines preceding the jobs themselves.
LD_LIBRARY_PATH=bin/lib
PHP=bin/php74-cli
You can then use $PHP
in your cronjob and have an up-to-date version of PHP 7 carry out that job for you. Alternatively you can omit the second line and use ~/bin/php74-cli
directly.
A list of available modules are listed below. If you require any other module, please let me know in the comments.
- bcmath
- Core
- ctype1
- curl
- date
- dom
- fileinfo
- filter
- gd
- hash
- iconv
- intl
- json
- libxml
- mbstring
- mysqlnd
- openssl
- pcre
- PDO
- pdo_mysql
- Phar
- Reflection
- session
- SimpleXML
- soap
- sockets
- SPL
- standard
- tokenizer
- xml
- xmlwriter
- zip
Update requested by Howie: These binaries are build from the original source code from the PHP website. If you prefer to build them yourself instead of using "wild" binaries from the web (which is totally understandable), you can follow the steps below. The additional library (libonig.so.2
) to make it work on a 1&1 environment is copied over from Debian and is not compiled by me.
./configure --enable-static --enable-cli --disable-all --enable-bcmath --disable-posix \
--with-curl --enable-phar --with-openssl --enable-json --enable-intl --enable-mbstring \
--enable-filter --enable-ctype --enable-pdo --with-pdo-mysql --enable-tokenizer \
--enable-xml --with-libxml --enable-dom --enable-fileinfo --enable-session \
--enable-simplexml --enable-soap --enable-sockets --enable-xmlwriter --with-zip \
--enable-gd --with-iconv --with-pear
make -j 6
The library can be found in the following package:
- libonig.so.2 - libonig2_5.9.5-3.2+deb8u2
Update 2: Good news everyone! 1&1 now has PHP 7.0 CLI available on all shared servers worldwide! I will keep PHP 7.1 & 7.2 available and updated for now, but for the majority of users 1&1 provides a solution out of the box.
Update 3: 1&1 now has PHP 7.1 CLI available. For some strange reason they also removed the 7.0 binary, which broke my cronjobs overnight. That last part I am not particularly happy about. I will drop PHP 7.1 and add PHP 7.0 again.
Update 4: PHP 7.3 is around the corner. PHP 7.0 has been removed.
Update 5: PHP 7.3 is now stable. PHP 7.2 has been removed.
Update 6: PHP 7.4 just hit alpha stage and has been added.
Update 7: Howie pointed out that PHP 7.3 is now officially available on IONOS servers. I removed the 7.3 binaries from the page.
Schreibe einen Kommentar