====== Apache httpd mit PHP ====== ===== php-cgi ===== Pakete Debian 8: ''apache2 php5-cgi'' 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#ini.cgi.force-redirect cgi.force_redirect = 0 #!/bin/sh # just because something works doesn't mean it's a good idea ... exec /usr/bin/php-cgi -c /tmp/cgi.force_redirect_no.ini )) a2enmod actions Action php-script /cgi-bin/php5 AddHandler php-script .php a2enconf simple-php5-cgi ===== mod_php ===== Pakete: * Debian (8): libapache2-mod-php5 * CentOS (7): php ===== php-fcgi ===== Pakete Debian 8: ''apache2 php5-cgi libapache2-mod-fcgid'' a2dismod cgi a2disconf serve-cgi-bin a2enmod fcgid # Context - server config FcgidMaxProcesses 150 # Otherwise php output shall be buffered FcgidOutputBufferSize 0 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AddHandler fcgid-script .php # may confict with other .php handlers #FcgidWrapper /usr/local/bin/php-fcgid-wrapper FcgidWrapper /usr/bin/php-cgi AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted a2enconf php-fcgi apachectl configtest apachectl graceful wget -nv -O - http://localhost/cgi-bin/phpinfo.php service apache2 status ===== php-fpm ===== Pakete Debian 8: ''apache2 php5-fpm'' a2dismod cgi a2disconf serve-cgi-bin a2enmod proxy_fcgi # we must declare a (any) parameter in here # or it won't register the proxy ahead of time ProxySet disablereuse=off ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ SetHandler proxy:fcgi://php-fpm AllowOverride None Require all granted a2enconf php-fpm apachectl configtest apachectl graceful 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 [phpinfo-app] … user = phpinfo group = phpinfo … listen = /var/run/php5-fpm-phpinfo.sock … service php5-fpm restart # we must declare a (any) parameter in here # or it won't register the proxy ahead of time ProxySet disablereuse=off ScriptAlias /phpinfo/ /srv/phpinfo/ SetHandler proxy:fcgi://php-fpm-phpinfo AllowOverride None Require all granted a2enconf php-fpm-phpinfo apachectl configtest apachectl graceful wget -nv -O - http://localhost/phpinfo/phpinfo.php service apache2 status