doujiufutaog59220 2017-05-18 17:44
浏览 93

2.4.25中的mod_rewrite在php-fpm 5.6.30中触发FCGI“主脚本未知”错误

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

This scenario fails under Apache 2.4.25 but works under Apache 2.4.20.

Test URL:

https://server/some-app/fun

And directory contents of:

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 up, and "/fun" to be passed as a GET parameter.

.htaccess OK

This version of .htaccess serves up index.php with no problems, 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 is:

Array
(
    [/fun] => 
)

.htaccess 404

RewriteEngine on

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

This one results in a 404, with PHP-FPM giving an error of:

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

Notice the difference is that I removed the question mark from the RewriteRule's substitution.

Relevant FCGI config:

<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 Logs

[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
'
[proxy:debug]  proxy_util.c(2171): AH00943: FCGI: has released connection for (*)
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了