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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测