2 votes

Comment définir le httpd.conf lors de l'utilisation de php-fpm avec php(5.3.8) et apache2 ?

Je veux utiliser fastcgi dans apache2 avec php(5.3.8).

J'ai installé fastcgi_module dans apache, et compilé php avec--enable-fpm. J'ai aussi trouvé des tutoriels où il y avait deux méthodes dans leurs paramètres :

FastCgiServer /usr/local/apache2/fcgi-bin/php-cgi -processes 10

ou

FastCgiExternalServer /usr/local/apache2/fcgi-bin/php-cgi -host 127.0.0.1:9000

Mais je ne peux pas trouver le php-cgi dans php 5.3.8. Que dois-je faire ensuite ? Comment définir le httpd.conf lors de l'utilisation de php-fpm avec php(5.3.8) et apache2 ?

4voto

regilero Points 1440

Le secret ici est que php-cgi n'est pas un vrai fichier, c'est un nom de fichier erroné utilisé en interne par Apache. Vous pourriez aussi l'appeler : false-php-cgi-catcher-which-do-not-exists .

J'ai écrit un Guide d'installation complet de php-fpm+apache2.2+chroot il y a quelques jours ici. Vous pouvez y jeter un coup d'oeil. Mais essayez d'abord de le faire fonctionner sans chroot. Notez qu'à partir d'apache 2.3, le meilleur outil pour php-fpm sera mod_proxy_fcgi

Voici un extrait du guide d'installation complet. J'utilise php5.external où vous voulez utiliser php-cgi .

# phpfpm/fastcgi
# Here we catch the 'false' Location used to inexistent php5.external
# and push it to the external FastCgi process via a socket
# note: socket path is relative to FastCgiIpcDir
# which is set in Main configuration /etc/apache2/mods-available/fastcgi.conf
<IfModule mod_fastcgi.c>
    # all .php files will be pushed to a php5-fcgi handler
    AddHandler php5-fcgi .php

    #action module will let us run a cgi script based on handler php5-fcgi
    Action php5-fcgi /fcgi-bin/php5.external

    # and we add an Alias to the fcgi location
    Alias /fcgi-bin/php5.external /php5.external

    # now we catch this cgi script which in fact does not exists on filesystem
    # we catch it on the url (Location)
    <Location /fcgi-bin/php5.external>
        # here we prevent direct access to this Location url,
        # env=REDIRECT_STATUS will let us use this fcgi-bin url
        # only after an internal redirect (by Action upper)
        Order Deny,Allow
        Deny from All
        Allow from env=REDIRECT_STATUS
    </Location>
</IfModule>
FastCgiExternalServer /php5.external -socket myapplication.sock -appConnTimeout 30 -idle-timeout 60

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X