Apache httpd mit PHP
php-cgi
mod_php
php-fcgi
Pakete Debian 8: apache2 php5-cgi libapache2-mod-fcgid
a2dismod cgi
a2disconf serve-cgi-bin
a2enmod fcgid
- /etc/apache2/conf-available/php-fcgi.conf
# Context - server config
FcgidMaxProcesses 150
# Otherwise php output shall be buffered
FcgidOutputBufferSize 0
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/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
</Directory>
a2enconf php-fcgi
apachectl configtest
apachectl graceful
- /usr/lib/cgi-bin/phpinfo.php
<?php
# do not use me in production
phpinfo();
#phpinfo(INFO_MODULES);
?>
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
- /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>
a2enconf php-fpm
apachectl configtest
apachectl graceful
- /usr/lib/cgi-bin/phpinfo.php
<?php
# do not use me in production
phpinfo();
#phpinfo(INFO_MODULES);
?>
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
- /etc/php5/fpm/pool.d/phpinfo-app.conf
[phpinfo-app]
…
user = phpinfo
group = phpinfo
…
listen = /var/run/php5-fpm-phpinfo.sock
…
service php5-fpm restart
- /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>
a2enconf php-fpm-phpinfo
apachectl configtest
apachectl graceful
- /srv/phpinfo/phpinfo.php
<?php
# do not use me in production
phpinfo();
phpinfo(INFO_MODULES);
?>
wget -nv -O - http://localhost/phpinfo/phpinfo.php
service apache2 status