Um php7 für den Betrieb mit Ihrem Server zu konfigurieren, müssen Sie einige Einstellungen vornehmen:
1. Stellen Sie sicher, dass Sie alle Spuren von entfernen php/php5
Öffnen Sie ein Terminal Ctrl+ Alt+ Tund:
cd /etc/apache2/mods-enabled
ls -la
Die Ausgabe sollte keinphp5.conf oder enthalten. php5.loadWenn dies der Fall ist, gehen Sie folgendermaßen vor:
# this is the proper way of disabling modules
sudo a2dismod php5
# run this only if the above command didn't remove the php5 sym-links
sudo rm php5.load
sudo rm php5.conf
Fügen Sie nun das php7.0.confund hinzu php7.0.load:
# this is the proper way of enabling modules
sudo a2enmod php7.0
# run this only if the above command didn't create the php7.0 sym-links
sudo ln -s php7.0.conf ../mods-available/php7.0.conf
sudo ln -s php7.0.load ../mods-available/php7.0.load
Die Ausgabe von ls -la php*sollte folgendermaßen aussehen:
lrwxrwxrwx 1 root root 29 Apr 15 03:55 php7.0.conf -> ../mods-available/php7.0.conf
lrwxrwxrwx 1 root root 29 Apr 15 03:55 php7.0.load -> ../mods-available/php7.0.load
Nach der Bearbeitung der Module kommen wir nun zum /etc/apache2/conf-enabledVerzeichnis. Entfernen Sie hier auch alle Spuren von PHP / PHP5sudo rm <name>
Dann, wenn nötig, machen Sie:
# the proper way of enabling configs
sudo a2enconf php7.0-cgi
sudo a2enconf php7.0-fpm
# do those commands only if the above didn't work out
sudo ln -s php7.0-cgi.conf ../conf-available/php7.0-cgi.conf
sudo ln -s php7.0-fpm.conf ../conf-available/php7.0-fpm.conf
Die Ausgabe von ls -la php*sollte folgendermaßen aussehen:
lrwxrwxrwx 1 root root 33 Apr 21 17:00 php7.0-cgi.conf -> ../conf-available/php7.0-cgi.conf
lrwxrwxrwx 1 root root 33 Apr 21 17:01 php7.0-fpm.conf -> ../conf-available/php7.0-fpm.conf
2. Starten Sie Apache2 neu
Stellen Sie vor dem Neustart von Apache sicher, dass Sie den Apache bereinigen und error.loganschließend neu starten:
sudo su
> /var/log/apache2/error.log
exit
sudo service apache2 restart
Überprüfen Sie nun die error.logAusgabe durch cat /var/log/apache2/error.log | less(Durch Weiterleiten durch weniger können Sie einfach nach oben und unten scrollen, um qdie Ausgabe zu beenden).
Wenn Ihr error.logviele enthält (und ich meine wörtlich einen Haufen davon), MIBS not foundtun einige Folgendes:
sudo apt install libsnmp-dev
sudo net-snmp-config --snmpconfpath
sudo apt-get install snmp snmp-mibs-downloader
sudo su
> /var/log/apache2/error.log
exit
sudo service apache2 restart
Das Häkchen nochmal das error.loges jetzt nur noch 3 Zeilen enthalten soll:
[Sat Apr 23 01:39:07.504005 2016] [mpm_prefork:notice] [pid 1647] AH00169: caught SIGTERM, shutting down
[Sat Apr 23 01:39:08.685774 2016] [mpm_prefork:notice] [pid 9590] AH00163: Apache/2.4.18 (Ubuntu) mod_perl/2.0.9 Perl/v5.22.1 configured -- resuming normal operations
[Sat Apr 23 01:39:08.685938 2016] [core:notice] [pid 9590] AH00094: Command line: '/usr/sbin/apache2'
Ihr Apache mit php7.0 sollte jetzt richtig konfiguriert sein.
phpBefehl) ist orthogonal zu den anderen PHP-SAPIs (apache2, FPM, CGI, ...), sodass Working Command Line PHP nichts über das Arbeiten mit PHP auf dem HTTP-Server aussagt.