Dies ist eine alte Version des Dokuments!
<title>HowTo / Anleitung zur Installation mehrere PHP Versionen auf Ubuntu 14.04 LTS</title>
Python Software proberties installieren
sudo apt-get install python-software-properties
Zusätzliche Packetquellen hinzugügen:
sudo add-apt-repository ppa:ondrej/php
Packetquellen aktualisieren:
sudo apt-get update
PHP 5.6, PHP7 und diverse Module installieren:
sudo apt-get install libapache2-mod-fastcgi php5.6-fpm php5.6 php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml php7.0-fpm libapache2-mod-fastcgi php7.0-fpm php7.0 php7.0-mcrypt php7.0-mbstring php7.0-mysql php7.0-zip php7.0-gd php7.0-xml
Apache default vhost anpassen:
sudo vim /etc/apache2/sites-enabled/000-default.conf
Code einfügen:
<IfModule mod_fastcgi.c> AddHandler php56-fcgi-www .php Action php56-fcgi-www /php56-fcgi-www Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization <Directory "/usr/lib/cgi-bin"> Require all granted </Directory> </IfModule> <IfModule mod_fastcgi.c> AddHandler php70-fcgi-www .php Action php70-fcgi-www /php70-fcgi-www Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php/php7.0-fpm.sock -pass-header Authorization <Directory "/usr/lib/cgi-bin"> Require all granted </Directory> </IfModule>
PHP 5.6 bzw 7.0 für jeweiligen Vhost aktivieren:
Der folgende Code muss zwischen
<VirtualHost *> ..... </<VirtualHost>
eingetragen werden.
PHP5.6:
<IfModule mod_fastcgi.c> <FilesMatch ".+\.ph(p[345]?|t|tml)$"> SetHandler php56-fcgi-www </FilesMatch> </IfModule>
oder
PHP 7:
<IfModule mod_fastcgi.c> <FilesMatch ".+\.ph(p[345]?|t|tml)$"> SetHandler php70-fcgi-www </FilesMatch> </IfModule>