
If you need some other version, just adjust the version in the package names and commands. Next we will install PHP 8.1 with some common modules, but not the Apache module version! Instead we will use php-fpm, the FastCGI version. If all is well and you get a response, continue with installation of PHP. Verify that apache work by going to with your browser. Sudo apt install apache2 libapache2-mod-fcgid

Next we will install Apache and the required extra module for FastCGI support: Sudo apt install ca-certificates apt-transport-https Install Apache and FastCGI module In case apt complains about " The method driver /usr/lib/apt/methods/https could not be found", install the following optional packages: Wget -q -O- | sudo tee /etc/apt//php.gpgĪnd add the PHP repository to your apt sources (adjust for the Raspberry OS version you are running, stretch/ buster or bullseye)Įcho "deb bullseye main" | sudo tee /etc/apt//php.list Lets start by adding the repository PGP key: So how to get a fresh version of PHP then ? Luckily the Debian PHP maintainer hosts a repository with fresh version of PHP and it includes armhf ( Note: armv7 or above only!) versions too.

In this guide we will start with installation of version 8.1 Add apt source repository for up to date PHP packages.It is not as a Apache module, libapache2-mod-php, anymore! And there is also the issues of the recommended way to run PHP these days. This tutorial will show installation instructions for PHP 8.1 but in case you need to use something else like 8.2 or still 7.4, just adjust the versions in the packages and commands. Note: The packages from the repository we will use are unfortunately not compatible with the ARMv6 based Raspberry Pis, you need to be using a ARMv7 or ARMv8 based Raspberry Pi 2, 3 or 4. Debian Bullseye does NOT come with PHP 8.Debian Bullseye comes with version 7.4.30 that is EOL already with security updates stopping very soon,.Debian Buster comes with version 7.2.9 that is already EOL:ed upstream and 7.3 is now unsupported.And with PHP that is especially a big issues as upstream PHP support is time limited, the only properly supported branch from PHP 7 is version 7.4 and even that is now out of both active support and security support, since. Pretty straight forward operation ? Sure, it is just an apt-get away, but once again we have the issue of old version in Bullseye (and Buster, Stretch if you are still on any of those).
