php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81670 Access log contains wrong values for "%r" (request URI) format string
Submitted: 2021-11-28 18:55 UTC Modified: 2021-11-29 20:53 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: amenshchikov at gmail dot com Assigned: bukka (profile)
Status: Assigned Package: FPM related
PHP Version: 8.1.0 OS: Debian 11
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
47 + 25 = ?
Subscribe to this entry?

 
 [2021-11-28 18:55 UTC] amenshchikov at gmail dot com
Description:
------------
Instead of real request URI (without query string), that contained in REQUEST_URI env variable, "%r" outputs SCRIPT_NAME value into access log.

In case I need request URI with query string, I can use "%{REQUEST_URI}e" and there is no problem. But when I need request URI without query string (as it intended with "%r") I don't know what to do.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-28 19:32 UTC] bukka@php.net
FPM takes request URI from the SCRIPT_NAME. I guess this is more a documentation issue (more description in docs maybe) / feature request so I will change this to feature request as we can't just change it at this stage anyway.
 [2021-11-28 19:32 UTC] bukka@php.net
-Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: bukka
 [2021-11-28 19:52 UTC] bukka@php.net
I assume that you really want to be able to log path info, right?
 [2021-11-28 20:06 UTC] ameshchikov at gmail dot com
Yes, you are right.

And honestly, I don't think that there is a documentation issue.
As I can see, access.format has dedicated placeholder "%f" for script_filename and it seems strange to use "%r" just for script_name (without full path to that script). It seems like "%r" intended to contain certainly request URI (or path info).
 [2021-11-29 20:53 UTC] bukka@php.net
What I meant that we should update documentation to state that "%r" is for SCRIPT_NAME rather than for REQUEST_URI fcgi env. We cannot just change the value as it could potentially break some scripts that already depend on it being a SCRIPT_NAME. The thing is that internally script name is taken as request uri so I don't think REQUEST_URI is used for anything but might have missed something.

In your case it doesn't really matter that much because if we just changed it to REQUEST_URI than it would contain a query so I guess it wouldn't help you. I guess specific flag for path info might help as it might not be always reliable to get it from env (at least the logic around that doesn't seem that straight forward as there are some hacks around Apache). You might actually give it a try and see if "%{PATH_INFO}e" or "%{ORIG_PATH_INFO}e" works for you?
 [2021-11-29 22:17 UTC] amenshchikov at gmail dot com
"%{PATH_INFO}e" produces empty string, "%{ORIG_PATH_INFO}e" produces "-".

I have the following nginx configuration:

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

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;

        include fastcgi.conf;
        internal;
    }
    ...
}
 [2021-12-01 06:58 UTC] amenshchikov at gmail dot com
Another one place where the same problem takes place — status page.
There "request URI" also shows the SCRIPT_NAME (with query string) instead of REQUEST_URI (see https://bugs.php.net/bug.php?id=72319).
 [2022-11-23 04:51 UTC] ami262 at gmail dot com
if you're actually running into this limit, you are probably abusing GET to begin with. You should use POST to transmit this sort of data -- especially since you even concede that you're using it to update values. If you check the link above, you'll notice that Apache even says "Under normal conditions, the value should not be changed from the default."

www.jcpenneykiosk.review
 [2022-12-12 04:58 UTC] CourtneySykes at rhyta dot com
You can use the built-in log () function to compute the log of a value in R. Pass the value for which you want to compute the log as an argument. The following is the syntax – x – The value for which you want to compute the log. base (optional) – The logarithmic base to use.

<https://www.mcdvoice.guru/>github.com
 [2023-05-03 02:32 UTC] geoff12aas at aol dot com
(https://www.cameo.com/jeremypiven)github.com
(https://www.facebook.com/jeremypivenpage/)github.com
(https://www.amazon.com/prime-video/actor/Jeremy-Piven/amzn1.dv.gti.785e61d6-1dd8-4777-88c4-b33c24097594)github.com
(https://pixarcars.fandom.com/wiki/Jeremy_Piven)github.com
(https://www.eonline.com/news/1371236/jeremy-piven-teases-his-idea-for-entourage-reboot)github.com
(https://www.rottentomatoes.com/celebrity/jeremy_piven)github.com
(https://twitter.com/jeremypiven)github.com
(https://www.emmys.com/bios/jeremy-piven)github.com
(https://www.blu-ray.com/Jeremy-Piven/70580/)github.com
(https://ramentertainment.com/jeremy-piven)github.com
(https://podcasts.apple.com/us/podcast/the-big-shark-jeremy-piven/id1558354780?i=1000608694599)github.com
(https://www.etonline.com/people/jeremy-piven)github.com
(https://www.ibdb.com/broadway-cast-staff/jeremy-piven-405986)github.com
(https://abcnews.go.com/GMA/Culture/video/jeremy-piven-talks-new-movie-sweetwater-98145023)github.com
(https://www.eonline.com/news/1371236/jeremy-piven-teases-his-idea-for-entourage-reboot)github.com
(https://www.youtube.com/watch?v=RtQRmT2cSAM)github.com
(https://www.instagram.com/jeremypiven/)github.com
(https://www.imdb.com/name/nm0005315/)github.com
(https://www.tvguide.com/celebrities/jeremy-piven/credits/3000397119/)github.com
(https://www.tcm.com/tcmdb/person/153053%7C174725/Jeremy-Piven#overview)github.com
(https://www.bravotv.com/watch-what-happens-live-with-andy-cohen/season-12/episode-96/videos/jeremy-pivens-mercury-poisoning)github.com
(https://www.tvinsider.com/people/jeremy-piven/)github.com
(https://en.wikipedia.org/wiki/Jeremy_Piven)github.com
(https://www.primetimer.com/item/Jeremy-Piven-to-host-celebrity-interview-podcast-How-U-Livin-J-Piven-WoSpdw)github.com
(https://www.imdb.com/name/nm0005315/news)github.com
(https://en.wikipedia.org/wiki/Jeremy_Piven)github.com
(https://www.the-sun.com/entertainment/tv/3810895/jeremy-piven-reveals-entourage-return-woke-twist-ari-gold/)github.com
(https://en.wikipedia.org/wiki/Jeremy_Piven)github.com
(https://www.imdb.com/title/tt3661590/)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC