Systemanpassungen für Apache2 mit PHP5 und mod_fastcgi

Voraussetzungen

  • mod_fastcgi
  • php5
  • apache2

Konfiguration

Verzeichnisse

mkdir -p /openpkg/tmp
chmod 1777 /openpkg/tmp
mkdir -p /openpkg/var/apache2/php-fastcgi

%{l_prefix}/etc/apache2/conf.d/ php5.conf

LoadModule fastcgi_module /openpkg/libexec/apache2/mod_fastcgi.so

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /openpkg/tmp
  AddHandler fastcgi-script .fcgi
  FastCgiServer "/openpkg/var/apache2/php-fastcgi/php5-fcgi" \
    -pass-header Authorization -appConnTimeout 30 -idle-timeout 60
  FastCgiConfig -appConnTimeout 30 -idle-timeout 60 -autoUpdate \
   -killInterval 600 -maxClassProcesses 20 -maxProcesses 20 -minProcesses 5 -restart
</IfModule>
<Location /php-fastcgi/>
  Options ExecCGI
  SetHandler fastcgi-script
</Location>

%{l_prefix}/etc/apache2/conf.d/ vhost.conf

NameVirtualHost  217.160.180.134:80
<VirtualHost 217.160.180.134:80>
    SuexecUserGroup openpkg openpkg
    ScriptAlias /php-fastcgi/ /openpkg/var/apache2/php-fastcgi/ 
    AddType application/x-httpd-fastphp .php
    Action application/x-httpd-fastphp /php-fastcgi/php5-fcgi
    ServerAdmin webmaster@tiri.li
    DocumentRoot /openpkg/var/apache2/html
    ServerName www.tiri.li
    ServerAlias tirili.zyklopaedie.de
    ErrorLog /openpkg/var/apache2/log/www.tiri.li-error_log
    CustomLog /openpkg/var/apache2/log/www.tiri.li-access_log common
<Directory /openpkg/var/apache2/html>
    Options FollowSymLinks ExecCGI Indexes MultiViews
    AllowOverride All
</Directory>
</VirtualHost>

%{l_prefix}/var/apache2/php-fastcgi/ php5-fcgi

#!/openpkg/bin/bash
set -x
(
echo $(date +%Y%m%d\ %H%M%S)
PHPRC="/openpkg/etc/php5" 
export PHPRC 
PHP_FCGI_CHILDREN=8 
export PHP_FCGI_CHILDREN 
PHP_FCGI_MAX_REQUESTS=5000 
export PHP_FCGI_MAX_REQUESTS 
exec /openpkg/cgi/php5 
) > /openpkg/var/apache2/log/fastcgi.log 2>&1 

Finale

Neustart von Apache 2

/openpkg/etc/rc apache2 restart

Test

lynx http://127.0.0.1/info.php

Wenn die Anzeige der nachfolgenden Darstellung ähnlich ist, dann hat es geklappt!

                                                                                                                            PHP Logo 

PHP Version 5.0.5

   System Linux p15183736 2.6.14-051030b #1 SMP Sun Oct 30 22:52:26 CET 2005 i686
   Build Date Nov 16 2005 20:55:54
   Configure Command './configure' '--prefix=/openpkg' '--enable-fastcgi'
   '--sysconfdir=/openpkg/etc/php5' '--with-config-file-path=/openpkg/etc/php5'
   '--libdir=/openpkg/lib/php5' '--disable-all' '--enable-calendar' '--with-mysql=/openpkg'
   '--without-pgsql' '--with-gd=/openpkg' '--with-jpeg-dir=/openpkg' '--with-png-dir=/openpkg'
   '--enable-gd-native-ttf' '--with-freetype-dir=/openpkg' '--with-db4=/openpkg' '--with-zlib=/openpkg'
   '--with-zlib-dir=/openpkg' '--with-bz2=/openpkg' '--with-openssl=/openpkg' '--with-ldap=/openpkg'
   '--with-mm=/openpkg' '--enable-session' '--with-pcre-regex=/openpkg' '--enable-ftp'
   '--with-gettext=/openpkg' '--with-imap=/openpkg' '--with-imap-ssl=/openpkg' '--enable-xml'
   '--enable-libxml' '--with-libxml-dir=/openpkg' '--with-xsl=/openpkg' '--enable-dom'
   '--with-libxml-dir=/openpkg' '--enable-bcmath' '--with-mhash=/openpkg' '--with-mcrypt=/openpkg'
   '--with-curl=/openpkg' '--with-gdbm=/openpkg' '--enable-versioning' '--with-pear=/openpkg/lib/php'
   '--enable-mbregex' '--enable-mbstring' '--with-exif' '--with-iconv=/openpkg' '--enable-cli'
   '--enable-cgi' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-memory-limit'
   Server API CGI/FastCGI
   Virtual Directory Support disabled
   Configuration File (php.ini) Path /home/openpkg/etc/php5/php.ini
   PHP API 20031224
   PHP Extension 20041030
   Zend Extension 220040412
...

Weitere Anpassungen

pear

Um auf der Befehlszeile pear Befehle ausführen zu können, sind folgende Schritte notwendig.

cd /openpkg/bin
ln -s php5 php

Anpassen der /openpkg/etc/php5/php.ini

# nur temporär
safe_mode          = off
$ pear channel-update pear.php.net
Retrieving channel.xml from remote server
Update of Channel "pear.php.net" succeeded
$ /openpkg/bin/pear install DB
downloading DB-1.7.6.tgz ...
Starting to download DB-1.7.6.tgz (124,807 bytes)
............................done: 124,807 bytes
install ok: DB 1.7.6
$ /openpkg/bin/pear list
Installed packages, channel pear.php.net:
=========================================
Package              Version State
Archive_Tar          1.3.1   stable
Console_Getopt       1.2     stable
DB                   1.7.6   stable
HTML_Template_IT     1.1.3   stable
Net_UserAgent_Detect 2.1.0   stable
PEAR                 1.4.4   stable
XML_RPC              1.4.4   stable
 
wissen/openpkg/debian/apache_php5_mod_fastcgi.txt · Zuletzt geändert: 05.09.2010 20:31
 
Recent changes RSS feed Donate Valid XHTML 1.0 Valid CSS Recent cached RSS feed cacert-signed web site: inhalt.serviert.de