Apache/PHP Basisinstallation

Wir installieren die PHP- und Apache-Grundumgebung

  • PHP 8 (CLI)

  • Apache2 Webserver Basis

Wir beginnen mit …

PHP

Hier: Unterstützung PHP Version 7.4 aus Debian 11 Quellen

Gefahr

PHP Version 7.4 hatte EOL 22. Nov. 2022!

Also: siehe z.B. Installanleitungen PHP 8 on Debian 10/11

https://www.linuxshelltips.com/install-php-8-debian/

mit Repo https://packages.sury.org/php/

Eine Anleitung wird in Praxis durchgespielt und dann funktioniert:

apt update
apt install php8.1-cli
# z.B. 8.1.16
php --version

Webserver Apache

Tipp

Wenn man Paket php8.1 installiert bekommt man den Apache2 gleich mit.

Hauptkonfiguration: /etc/apache2/apache2.conf

apt install apache2
# Serverstartmessage AH00558: could not reliably ...
# /etc/apache2/apache2.conf with: ServerName vm-bullseye
# Serverrelated commands:
apachectl configtest
systemctl restart apache2.service

Hier mal ein paar Meldungszeilen nach dem Install von apache2-Paket:

.....
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Trigger für man-db (2.9.4-2) werden verarbeitet ...
Trigger für libc-bin (2.31-13) werden verarbeitet ...

root@vm-lpic-server:~# apachectl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

root@vm-lpic-server:~# cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf-bak
root@vm-lpic-server:~# vim /etc/apache2/apache2.conf

root@vm-lpic-server:~# apachectl configtest
Syntax OK

Die Grundinstallation des Apache ist jetzt vorhanden und kann von einem Client (Browser) getestet werden:

Apache läuft

Apache läuft