web-dev-qa-db-fra.com

php7 sur 16.04 ne fonctionne pas après la réinstallation d'Apache

J'étais en train de modifier Apache et j'ai tué la configuration. Apache n'a pas fonctionné. Donc, je l'ai enlevé et réinstallé. Apache fonctionne. Mysql fonctionne. Cependant, le test PHP ne fonctionnera pas. Le fichier de test php se trouve dans/var/www/html mais ne sera pas affiché. http: //localhost/test2.php dans le navigateur, donnez-moi juste un écran vide.

Réinstaller PHP ne semble pas vous aider. Je viens d'obtenir un écran vide sans message d'erreur. WordPress ne vient pas non plus.

Aucune suggestion?

Journal des erreurs:

[Sun Nov 05 16:34:24.764857 2017] [mpm_event:notice] [pid 3887:tid 140535676766080] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Nov 05 16:34:24.764954 2017] [core:notice] [pid 3887:tid 140535676766080] AH00094: Command line: '/usr/sbin/Apache2'
[Sun Nov 05 16:37:41.761332 2017] [mpm_event:notice] [pid 3887:tid 140535676766080] AH00491: caught SIGTERM, shutting down
[Sun Nov 05 16:37:42.834654 2017] [mpm_event:notice] [pid 4105:tid 140542285068160] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Nov 05 16:37:42.834749 2017] [core:notice] [pid 4105:tid 140542285068160] AH00094: Command line: '/usr/sbin/Apache2'
[Sun Nov 05 16:57:35.990992 2017] [mpm_event:notice] [pid 4105:tid 140542285068160] AH00491: caught SIGTERM, shutting down
[Sun Nov 05 16:57:37.056553 2017] [mpm_event:notice] [pid 4647:tid 140007533836160] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Nov 05 16:57:37.056632 2017] [core:notice] [pid 4647:tid 140007533836160] AH00094: Command line: '/usr/sbin/Apache2'
[Sun Nov 05 18:01:18.870157 2017] [mpm_event:notice] [pid 4647:tid 140007533836160] AH00491: caught SIGTERM, shutting down
[Sun Nov 05 18:01:19.944634 2017] [mpm_event:notice] [pid 6272:tid 140286123997056] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Nov 05 18:01:19.944719 2017] [core:notice] [pid 6272:tid 140286123997056] AH00094: Command line: '/usr/sbin/Apache2'
[Sun Nov 05 18:07:31.641146 2017] [mpm_event:notice] [pid 6272:tid 140286123997056] AH00491: caught SIGTERM, shutting down
[Mon Nov 06 06:55:45.343332 2017] [mpm_event:notice] [pid 1031:tid 139664376633216] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Nov 06 06:55:45.366228 2017] [core:notice] [pid 1031:tid 139664376633216] AH00094: Command line: '/usr/sbin/Apache2'
[Mon Nov 06 07:00:30.525862 2017] [mpm_event:notice] [pid 1031:tid 139664376633216] AH00493: SIGUSR1 received.  Doing graceful restart
3
givonz

Essayez d'installer et d'activer le module php, redémarrez Apache:

Sudo apt install libapache2-mod-php7.0  
Sudo a2enmod php7.0                     
Sudo systemctl restart Apache2.service  

Essayez ensuite d'accéder à nouveau à votre page <?php phpinfo(); ?>.


Voici ce que la commande ci-dessus fait:

  • apt install libapache2-mod-php7.0 - Installez le module PHP d'Apache pour php7.0.

  • a2enmod php7.0 - Activer le module - cette commande créera un lien symbolique pour les fichiers du module de /etc/Apache2/mods-available à /etc/Apache2/mods-enabled.

  • systemctl restart Apache2.service - Redémarrez Apache pour accepter la nouvelle configuration (il peut s'agir simplement de reload).

    Tous les modules du répertoire /etc/Apache2/mods-enabled sont inclus dans le fichier de configuration principal d'Apache /etc/Apache2/Apache2.conf par les directives:

    IncludeOptional mods-enabled/*.load
    IncludeOptional mods-enabled/*.conf
    
2
pa4080