Mod_rewrite in 2.4.25 FCGI launch "Primary script unknown" error in php-fpm 5.6.30

  • Apache: 2.4.25 (localhost)
  • PHP-FPM: 5.6.30

This script does not work under Apache 2.4.25, but it does work under Apache 2.4.20.

Test URL:

https://server/some-app/fun

And the contents of the directory:

drwxr-xr-x 118 xx root 4012 May 18 16:12 ..
-rw-r--r--   1 xx root  155 May 18 16:15 index.php
-rwxr-xr-x   1 xx root  450 May 18 16:25 .htaccess
drwxr-xr-x   4 xx root  136 May 18 16:25 .

      

I expect index.php to be served and "/ fun" will be passed as a GET parameter.

.htaccess OK

This version .htaccess

serves index.php without issue, and the GET parameters show "/ fun" as expected:

RewriteEngine on

RewriteCond $1 !^(index.php)
RewriteRule ^(.*)$ index.php?/$1 [L,NS]

      

index.php is served and $ _GET:

Array
(
    [/fun] => 
)

      

.htaccess 404

RewriteEngine on

RewriteCond $1 !^(index.php)
RewriteRule ^(.*)$ index.php/$1 [L,NS]

      

The result is 404, with PHP-FPM giving the error:

[proxy_fcgi:error]  [client 192.168.200.1:59812] AH01071: Got error 'Primary script unknown\n'

      

Note that the difference is that I removed the question mark from the RewriteRule substitution.

Relevant FCGI configuration:

<IfModule !mod_php5.c>
    <FilesMatch \.php$>
        SetHandler "proxy:unix:///var/run/php-fpm-xyz.sock|fcgi://xyz/"
    </FilesMatch>
</IfModule>

Timeout 3000

DirectoryIndex index.php

      

Sanitized magazines

[ssl:info]   AH01964: Connection to child 18 established (server servername:443)
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of Require all granted: granted
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of <RequireAny>: granted
[perdir /data/www/some-app/] strip per-dir prefix: /data/www/some-app/fun -> fun
[perdir /data/www/some-app/] applying pattern '^(.*)$' to uri 'fun'
[perdir /data/www/some-app/] RewriteCond: input='fun' pattern='!^(index.php)' => matched
[perdir /data/www/some-app/] rewrite 'fun' -> 'index.php/fun'
[perdir /data/www/some-app/] add per-dir prefix: index.php/fun -> /data/www/some-app/index.php/fun
[perdir /data/www/some-app/] strip document_root prefix: /data/www/some-app/index.php/fun -> /some-app/index.php/fun
[perdir /data/www/some-app/] internal redirect with /some-app/index.php/fun [INTERNAL REDIRECT]
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of Require all granted: granted
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of <RequireAny>: granted
[perdir /data/www/some-app/] add path info postfix: /data/www/some-app/index.php -> /data/www/some-app/index.php/fun
[perdir /data/www/some-app/] strip per-dir prefix: /data/www/some-app/index.php/fun -> index.php/fun
[perdir /data/www/some-app/] applying pattern '^(.*)$' to uri 'index.php/fun'
[perdir /data/www/some-app/] RewriteCond: input='index.php/fun' pattern='!^(index.php)' => not-matched
[perdir /data/www/some-app/] pass through /data/www/some-app/index.php
[proxy:debug]  mod_proxy.c(1228):  AH01143: Running scheme unix handler (attempt 0)
[proxy_fcgi:debug]  mod_proxy_fcgi.c(913):  AH01076: url: fcgi://xyz//data/www/some-app/index.php proxyname: (null) proxyport: 0
[proxy_fcgi:debug]  mod_proxy_fcgi.c(920):  AH01078: serving URL fcgi://xyz//data/www/some-app/index.php
[proxy:debug]  proxy_util.c(2156): AH00942: FCGI: has acquired connection for (*)
[proxy:debug]  proxy_util.c(2209):  AH00944: connecting fcgi://xyz//data/www/some-app/index.php to xyz:8000
[proxy:debug]  proxy_util.c(2246):  AH02545: fcgi: has determined UDS as /var/run/php-fpm-xyz.sock
[proxy:debug]  proxy_util.c(2418):  AH00947: connected //data/www/some-app/index.php to httpd-UDS:0
[proxy:debug]  proxy_util.c(2786): AH02823: FCGI: connection established with Unix domain socket /var/run/php-fpm-xyz.sock (*)
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of Require all granted: granted
[authz_core:debug]  mod_authz_core.c(809):  AH01626: authorization result of <RequireAny>: granted
[proxy_fcgi:error]   AH01071: Got error 'Primary script unknown\n'
[proxy:debug]  proxy_util.c(2171): AH00943: FCGI: has released connection for (*)

      

+3


source to share





All Articles