Apache Web Server (PHP 7.4) installeren op een Raspberry Pi
In dit artikel leggen we uit hoe je PHP op een Raspberry Pi kunt installeren. Je kunt zelf kiezen uit:
- PHP 7.4
- PHP 7.3
- PHP 7.2
- PHP 7.1
- PHP 5.6
Geef onderstaande commando’s in de terminal in om de huidige packages bij te werken naar de meest recente versie:
1 2 |
sudo apt update sudo apt upgrade -y && sudo reboot |
Voer onderstaande commando’s uit om de benodigde packages op de Raspberry Pi te installeren:
1 2 3 |
sudo apt -y install lsb-release apt-transport-https ca-certificates sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list |
PHP 7.4 installeren
Geef onderstaande commando’s in om PHP 7.4 te installeren:
1 2 |
sudo apt update sudo apt -y install php7.4 |
Installeer ook de benodigde PHP modules:
1 |
sudo apt install php7.4-cli php7.4-common php7.4-curl php7.4-mbstring php7.4-mysql php7.4-xml |
Herstart de Raspberry Pi:
1 |
sudo reboot |
PHP 7.3 installeren
Geef onderstaande commando’s in om PHP 7.3 te installeren:
1 2 |
sudo apt update sudo apt -y install php7.3 |
Installeer ook de benodigde PHP modules:
1 |
sudo apt install php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml |
Herstart de Raspberry Pi:
1 |
sudo reboot |
PHP 7.2 installeren
Geef onderstaande commando’s in om PHP 7.2 te installeren:
1 2 |
sudo apt update sudo apt -y install php7.2 |
Installeer ook de benodigde PHPmodules:
1 |
sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-mysql php7.2-xml |
Herstart de Raspberry Pi:
1 |
sudo reboot |
PHP 7.1 installeren
Geef onderstaande commando’s in om PHP 7.1 te installeren:
1 2 |
sudo apt update sudo apt -y install php7.1 |
Installeer ook de benodigde PHP modules:
1 |
sudo apt install php7.1-cli php7.1-common php7.1-curl php7.1-mbstring php7.1-mysql php7.1-xml |
Herstart de Raspberry Pi:
1 |
sudo reboot |
PHP 5.6 installeren
Geef onderstaande commando’s in om PHP 5.6 te installeren:
1 2 |
sudo apt update sudo apt -y install php5.6 |
Installeer ook de benodigde PHP modules:
1 |
sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-mbstring php5.6-mysql php5.6-xml |
Herstart de Raspberry Pi:
1 |
sudo reboot |
PHP.INI aanpassen
Voor alle PHP-versie’s is het raadzaam om de execution time en de input time te verhogen:
1 |
sudo nano /etc/php/7.3/apache2/php.ini |
Wijzig max_execution_time van 30 naar 60 en wijzig max_input_time van 60 naar 120.