====== Installation Apache+PHP sous Ubuntu 20.04 ====== ===== Installation d'Apache ===== sudo apt update sudo apt install apache2 Aller sur [[http://adresse_du_serveur/]] => la page **Apache2 Ubuntu Default Page** s'affiche. ===== Installation de PHP ===== sudo apt install php libapache2-mod-php php-mysql Tester le fonctionnement de PHP : php -v ===== Installation de Composer ===== Se référer à [[php:composer:installation_de_php_et_composer|cette page]]. ===== Configuration du VirtualHost ===== Éditer la configuration du site par défaut : sudo vim /etc/apache2/sites-available/000-default.conf Y coller la configuration suivante : ServerName localhost ServerAdmin myself@mail.com DocumentRoot /var/www Options Indexes FollowSymLinks Multiviews AllowOverride all Require all denied Require all granted Allow from all Ensuite relancer Apache : sudo systemctl reload apache2 Tester si la configuration est correcte : sudo apachectl configtest Écrire un fichier **test.php** : ===== Configuration de PHP ===== La page **PHP Info** montre le chemin du fichier de configuration utilisé. ^ Loaded Configuration File | /etc/php/7.4/apache2/php.ini | En développement, activer l'affichage des erreurs : display_errors = On display_startup_errors = On error_reporting = E_ALL En production, les valeurs par défaut sont déjà bonnes : display_errors = Off display_startup_errors = Off error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT Recharger Apache après avoir modifié la config : sudo systemctl reload apache2.service Vérifier sur la page **PHP Info** si les options ont bien été modifiées.