Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


fortgeschrittene:apache-php

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
fortgeschrittene:apache-php [2016/12/22 08:40]
ingo_wichmann [php-cgi]
fortgeschrittene:apache-php [2018/11/12 23:23] (aktuell)
Zeile 45: Zeile 45:
  
 ===== mod_php ===== ===== mod_php =====
-Pakete: libapache2-mod-php5+Pakete:  
 +  * Debian (8): libapache2-mod-php5 
 +  * CentOS (7): php
  
 <code php /​var/​www/​html/​phpinfo.php>​ <code php /​var/​www/​html/​phpinfo.php>​
Zeile 88: Zeile 90:
 # do not use me in production # do not use me in production
   phpinfo();   phpinfo();
-  phpinfo(INFO_MODULES);​+  ​#phpinfo(INFO_MODULES);​
 ?> ?>
 </​code>​ </​code>​
Zeile 96: Zeile 98:
   service apache2 status   service apache2 status
  
 +===== php-fpm =====
 +Pakete Debian 8: ''​apache2 php5-fpm''​
  
 +  a2dismod cgi
 +  a2disconf serve-cgi-bin
 +  a2enmod proxy_fcgi
 +
 +<file txt /​etc/​apache2/​conf-available/​php-fpm.conf>​
 +<Proxy "​unix:/​var/​run/​php5-fpm.sock|fcgi://​php-fpm">​
 +  # we must declare a (any) parameter in here 
 +  # or it won't register the proxy ahead of time
 +  ProxySet disablereuse=off
 +</​Proxy>​
 +ScriptAlias /cgi-bin/ /​usr/​lib/​cgi-bin/​
 +<​Directory "/​usr/​lib/​cgi-bin">​
 +  <​FilesMatch "​.+\.php$">​
 +    SetHandler proxy:​fcgi://​php-fpm
 +  </​FilesMatch>​
 +  AllowOverride None
 +  Require all granted
 +</​Directory>​
 +</​file>​
 +
 +  a2enconf php-fpm
 +
 +  apachectl configtest
 +  apachectl graceful
 +
 +<code php /​usr/​lib/​cgi-bin/​phpinfo.php>​
 +<?php
 +# do not use me in production
 +  phpinfo();
 +  #​phpinfo(INFO_MODULES);​
 +?>
 +</​code>​
 +
 +  wget -nv -O - http://​localhost/​cgi-bin/​phpinfo.php
 +
 +  service apache2 status
 +
 +===== php-fpm mit anderem Benutzer =====
 +Pakete Debian 8: ''​apache2 php5-fpm''​
 +
 +  a2dismod cgi
 +  a2disconf serve-cgi-bin
 +  a2enmod proxy_fcgi
 +
 +  useradd -r -s /​usr/​sbin/​nologin -d /​srv/​phpinfo phpinfo
 +  mkdir /​srv/​phpinfo
 +  cp /​etc/​php5/​fpm/​pool.d/​{www,​phpinfo-app}.conf
 +
 +<file txt /​etc/​php5/​fpm/​pool.d/​phpinfo-app.conf>​
 +[phpinfo-app]
 +
 +user = phpinfo
 +group = phpinfo
 +
 +listen = /​var/​run/​php5-fpm-phpinfo.sock
 +
 +</​file>​
 +
 +  service php5-fpm restart
 +
 +<file txt /​etc/​apache2/​conf-available/​php-fpm-phpinfo.conf>​
 +<Proxy "​unix:/​var/​run/​php5-fpm-phpinfo.sock|fcgi://​php-fpm-phpinfo">​
 +  # we must declare a (any) parameter in here 
 +  # or it won't register the proxy ahead of time
 +  ProxySet disablereuse=off
 +</​Proxy>​
 +ScriptAlias /phpinfo/ /​srv/​phpinfo/​
 +<​Directory "/​srv/​phpinfo/">​
 +  <​FilesMatch "​.+\.php$">​
 +    SetHandler proxy:​fcgi://​php-fpm-phpinfo
 +  </​FilesMatch>​
 +  AllowOverride None
 +  Require all granted
 +</​Directory>​
 +</​file>​
 +
 +  a2enconf php-fpm-phpinfo
 +
 +  apachectl configtest
 +  apachectl graceful
 +
 +<code php /​srv/​phpinfo/​phpinfo.php>​
 +<?php
 +# do not use me in production
 +  phpinfo();
 +  phpinfo(INFO_MODULES);​
 +?>
 +</​code>​
 +
 +  wget -nv -O - http://​localhost/​phpinfo/​phpinfo.php
 +
 +  service apache2 status
  
  
fortgeschrittene/apache-php.1482396015.txt.gz · Zuletzt geändert: 2016/12/22 08:40 von ingo_wichmann