You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2022/12/12 14:55:42 UTC

[Bug 66387] New: Per directory fcgi handler is ignored if there is a global fcgi handler

https://bz.apache.org/bugzilla/show_bug.cgi?id=66387

            Bug ID: 66387
           Summary: Per directory fcgi handler is ignored if there is a
                    global fcgi handler
           Product: Apache httpd-2
           Version: 2.4.54
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_proxy_fcgi
          Assignee: bugs@httpd.apache.org
          Reporter: bjoernv@arcor.de
  Target Milestone: ---

Many users ask if it is possible to have multiple PHP versions in parallel.
This is needed if multiple PHP applications in different locations needs
special PHP versions.

This works per vhost, but per directory it is tricky to setup.

Testing shows, that the SetHandler directive is ignored, if the is a global or
vhost SetHandler for fcgi.

This does not match the documentation of SetHandler:

"SetHandler Directive
Description: Forces all matching files to be processed by a handler
Syntax: SetHandler handler-name|none|expression
Context: server config, virtual host, directory, .htaccess"

One example:

1) Enable fgci globally using the openSUSE Tumbleweed PHP FPM configuration:
<IfModule mod_proxy_fcgi.c>
        <FilesMatch "\.ph(p[34578]?|tml)$">
                SetHandler "proxy:fcgi://127.0.0.1:9000"
        </FilesMatch>

        <FilesMatch "\.php[34578]?s$">
                SetHandler "proxy:fcgi://127.0.0.1:9000"
        </FilesMatch>

        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php7
        DirectoryIndex index.php8
        DirectoryIndex index.php
</IfModule>

2) Setup a directory test in webroot with an .htaccess file

# mkdir test
# cat test/.htaccess
SetHandler
"proxy:unix:none-existing-path-is-ignored|fcgi://none-existing-localhost-is-ignored"
# cat test/index.php
<?php phpinfo(); ?>

3) Reload Apache

Result: http://localhost/test/index.php shows PHP-Info from PHP 8.1

Now disable the global SetHandler

4) rm /etc/apache2/conf.d/php8-fpm.conf

5) Reload Apache

Result: http://localhost/test/index.php downloads the index.php source code

Now set the correct handler into test/.htaccess

6) cat test/.htaccess

SetHandler "proxy:unix:/var/run/php-fpm-www.sock|fcgi://localhost"

Result: http://localhost/test/index.php shows PHP-Info from PHP 8.1

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 66387] Per directory fcgi handler is ignored if there is a global fcgi handler

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66387

Bjoern Voigt <bj...@arcor.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bjoernv@arcor.de

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org