admin_grundlagen:apache-php
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Nächste Überarbeitung | Vorherige Überarbeitung | ||
| admin_grundlagen:apache-php [2016/11/25 15:23] – angelegt ingo_wichmann | admin_grundlagen:apache-php [2018/11/12 23:23] (aktuell) – [mod_php] ingo_wichmann | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | Apache mit PHP: | + | ====== |
| + | ===== php-cgi ===== | ||
| - | CentOS 7: | + | Pakete Debian 8: '' |
| - | yum install | + | |
| - | <file php /var/www/html/php_info.php> | + | a2enmod cgi |
| + | a2enconf serve-cgi-bin | ||
| + | |||
| + | (( Das würde mit den folgenden Ergänzungen schon reichen. Wird aber von php nicht empfohlen. | ||
| + | < | ||
| + | # do not use this in production, see | ||
| + | # http://php.net/manual/de/ini.core.php# | ||
| + | cgi.force_redirect = 0 | ||
| + | </file> | ||
| + | |||
| + | <code bash / | ||
| + | #!/bin/sh | ||
| + | # just because something works doesn' | ||
| + | exec / | ||
| <?php | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | # | ||
| + | ?> | ||
| + | </ | ||
| + | )) | ||
| + | a2enmod actions | ||
| - | phpinfo(); | + | <file txt / |
| + | < | ||
| + | Action php-script / | ||
| + | AddHandler | ||
| + | </ | ||
| + | </ | ||
| + | a2enconf simple-php5-cgi | ||
| + | |||
| + | <code php / | ||
| + | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | # | ||
| ?> | ?> | ||
| + | </ | ||
| + | |||
| + | ===== mod_php ===== | ||
| + | Pakete: | ||
| + | * Debian (8): libapache2-mod-php5 | ||
| + | * CentOS (7): php | ||
| + | |||
| + | <code php / | ||
| + | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | # | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | ===== php-fcgi ===== | ||
| + | Pakete Debian 8: '' | ||
| + | |||
| + | a2dismod cgi | ||
| + | a2disconf serve-cgi-bin | ||
| + | a2enmod fcgid | ||
| + | |||
| + | <file txt / | ||
| + | # Context - server config | ||
| + | FcgidMaxProcesses 150 | ||
| + | # Otherwise php output shall be buffered | ||
| + | FcgidOutputBufferSize 0 | ||
| + | |||
| + | ScriptAlias /cgi-bin/ / | ||
| + | < | ||
| + | AddHandler fcgid-script .php # may confict with other .php handlers | ||
| + | # | ||
| + | FcgidWrapper / | ||
| + | AllowOverride None | ||
| + | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
| + | Require all granted | ||
| + | </ | ||
| </ | </ | ||
| - | | + | |
| - | testen: http:// | + | a2enconf php-fcgi |
| - | | + | |
| + | apachectl configtest | ||
| + | apachectl graceful | ||
| + | |||
| + | <code php / | ||
| + | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | # | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | wget -nv -O - http:// | ||
| + | |||
| + | | ||
| + | |||
| + | ===== php-fpm ===== | ||
| + | Pakete Debian 8: '' | ||
| + | |||
| + | a2dismod cgi | ||
| + | a2disconf serve-cgi-bin | ||
| + | a2enmod proxy_fcgi | ||
| + | |||
| + | <file txt / | ||
| + | <Proxy " | ||
| + | # we must declare a (any) parameter in here | ||
| + | # or it won't register the proxy ahead of time | ||
| + | ProxySet disablereuse=off | ||
| + | </ | ||
| + | ScriptAlias /cgi-bin/ / | ||
| + | < | ||
| + | < | ||
| + | SetHandler proxy: | ||
| + | </ | ||
| + | AllowOverride None | ||
| + | Require all granted | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | a2enconf php-fpm | ||
| + | |||
| + | apachectl configtest | ||
| + | apachectl graceful | ||
| + | |||
| + | <code php / | ||
| + | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | # | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | wget -nv -O - http:// | ||
| + | |||
| + | | ||
| + | |||
| + | ===== php-fpm mit anderem Benutzer ===== | ||
| + | Pakete Debian 8: '' | ||
| + | |||
| + | a2dismod cgi | ||
| + | a2disconf serve-cgi-bin | ||
| + | a2enmod proxy_fcgi | ||
| + | |||
| + | useradd -r -s /usr/sbin/ | ||
| + | mkdir / | ||
| + | cp / | ||
| + | |||
| + | <file txt /etc/php5/ | ||
| + | [phpinfo-app] | ||
| + | … | ||
| + | user = phpinfo | ||
| + | group = phpinfo | ||
| + | … | ||
| + | listen = / | ||
| + | … | ||
| + | </ | ||
| + | |||
| + | service php5-fpm restart | ||
| + | |||
| + | <file txt / | ||
| + | <Proxy " | ||
| + | # we must declare a (any) parameter in here | ||
| + | # or it won't register the proxy ahead of time | ||
| + | ProxySet disablereuse=off | ||
| + | </ | ||
| + | ScriptAlias /phpinfo/ / | ||
| + | < | ||
| + | < | ||
| + | SetHandler proxy: | ||
| + | </ | ||
| + | AllowOverride None | ||
| + | Require all granted | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | a2enconf php-fpm-phpinfo | ||
| + | |||
| + | apachectl configtest | ||
| + | apachectl graceful | ||
| + | |||
| + | <code php / | ||
| + | <?php | ||
| + | # do not use me in production | ||
| + | phpinfo(); | ||
| + | phpinfo(INFO_MODULES); | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | wget -nv -O - http:// | ||
| + | |||
| + | service apache2 status | ||
| + | |||
admin_grundlagen/apache-php.1480087436.txt.gz · Zuletzt geändert: (Externe Bearbeitung)
