php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72319 FPM status page shows wrong request_uri
Submitted: 2016-06-02 20:00 UTC Modified: -
Votes:23
Avg. Score:4.7 ± 0.6
Reproduced:22 of 22 (100.0%)
Same Version:9 (40.9%)
Same OS:9 (40.9%)
From: zzromanzz at gmail dot com Assigned:
Status: Open Package: FPM related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zzromanzz at gmail dot com
New email:
PHP Version: OS:

 

 [2016-06-02 20:00 UTC] zzromanzz at gmail dot com
Description:
------------
PHP FPM status page (FPM config: pm.status_path = /status) in full mode (/status&full) shows 'request uri' from SCRIPT_NAME CGI variable.

This column should report proper value e.g. from REQUEST_URI CGI variable.

There is no way I can determine real uri 'request uri' value when all requests are handled by index.php file and SCRIPT_NAME variable is set to value 'index.php' (I believe this is correct approach)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-05 07:12 UTC] zzromanzz at gmail dot com
Ping :)
 [2021-04-13 21:15 UTC] a dot rzadkowolski at gmail dot com
Also got into this issue today. Also happens with slow log.

This is due how fpm_main.c replaces request_uri with SCRIPT_NAME.

Any idea how nginx/fpm users can work around it?

It happens with basically such setup (notice internal part).

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\.php(/|$) {		
        fastcgi_pass php74;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
    }

And if you look at status page you will notice that example.com https://example.com/login
renders as:
request URI:          /index.php

Even though in php I can see proper REQUEST_URI variable inside $_SERVER vars.
 [2024-02-26 09:07 UTC] seb35 at seb35 dot fr
A workaround is to define the FastCGI variable SCRIPT_NAME: in nginx:
 fastcgi_param  SCRIPT_NAME $request_uri;
As described in the blog post jolicode.com/blog/how-to-see-full-request-uri-in-fpm-status

I'm not sure of the exact meaning of SCRIPT_NAME (versus REQUEST_URI), but perhaps the FPM status page could directly use REQUEST_URI in the column request_uri, or possibly use REQUEST_URI and, if empty, have a fallback to SCRIPT_NAME?

Another intermediary solution would be to add both in the JSON/XML/etc result, so that it is easier to display according to its own configuration, by modifying this file https://github.com/php/php-src/blob/master/sapi/fpm/status.html.in .
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC