Problems with fastcgi php migration

Igor Sysoev is at rambler-co.ru
Thu Mar 13 17:25:19 MSK 2008


On Thu, Mar 13, 2008 at 10:03:32AM -0400, Ian M. Evans wrote:

> Denis F. Latypoff wrote:
> >hey, why aren't you want to compile nginx with --with-debug and see what
> >happens in the error.log with the 'error_log /path debug' mode?
> 
> Denis,
> 
> As requested, here's the debug output. In this example,
> /fest/tribeca/2003/2/photos works
> /fest/tribeca/2003/2/photos/ tosses a 404
> and in the debug, /fest/tribeca/2003/2/photos/1 tosses a 404:
> 
> 10085#0: *741 find location for "/fest/tribeca/2003/2/photos/1"
> 10085#0: *741 find location: "/"
> 10085#0: *741 find location: ~ "\.(shtml|php)$"
> 10085#0: *741 find location: ~ 
> "^/(testgalleries|galleries|poll|news|photos)(/|$)"
> 10085#0: *741 find location: ~ 
> "/(testgalleries|galleries|poll|news|photos)(/|$)"
> 10085#0: *741 using configuration 
> "/(testgalleries|galleries|poll|news|photos)(/|$)"
> 10085#0: *741 http cl:-1 max:1048576
> 10085#0: *741 generic phase: 2
> 10085#0: *741 http script complex value
> 10085#0: *741 http script var: "/fest/tribeca/2003/2/photos/1"
> 10085#0: *741 http script set var
> 10085#0: *741 http script value: ""
> 10085#0: *741 http script set var
> 10085#0: *741 http script var
> 10085#0: *741 http script var: "/fest/tribeca/2003/2/photos/1"
> 10085#0: *741 http script regex: 
> "^/(?:.+/)?(testgalleries|galleries|poll|news|photos)(/.*)"
> 10085#0: *741 http script if
> 10085#0: *741 http script complex value
> 10085#0: *741 http script capture: "photos"
> 10085#0: *741 http script set var
> 10085#0: *741 http script complex value
> 10085#0: *741 http script capture: "/1"

The rewrite module debug log is as ugly as it is itself.
Here I see that
1) $script_name get "photos" capture, and it probaly equal to "/photos".
2) $path_info if "/1".

> 10085#0: *741 http script set var
> 10085#0: *741 post rewrite phase: 3
> 10085#0: *741 generic phase: 4
> 10085#0: *741 access phase: 5
> 10085#0: *741 access phase: 6
> 10085#0: *741 post access phase: 7
> 10085#0: *741 http init upstream, client timer: 0
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http script var: ""
> 10085#0: *741 http script copy: ""
> 10085#0: *741 http cleanup add: 0825F484
> 10085#0: *741 get rr peer, try: 1
> 10085#0: *741 socket 16
> 10085#0: *741 rtsig add connection: fd:16 signo:43
> 10085#0: *741 connect to 127.0.0.1:10004, fd:16 #742
> 10085#0: *741 http upstream connect: -2
> 10085#0: *741 event timer add: 16: 60000:2825487964
> 10085#0: rtsig add connection: fd:6 signo:43
> 10085#0: *741 post event 08297384
> 10085#0: *741 delete posted event 08297384
> 10085#0: *741 http upstream send request handler
> 10085#0: *741 http upstream send request
> 10085#0: *741 chain writer buf fl:0 s:1512
> 10085#0: *741 chain writer in: 0825F490
> 10085#0: *741 writev: 1512
> 10085#0: *741 chain writer out: 00000000
> 10085#0: *741 event timer del: 16: 2825487964
> 10085#0: *741 event timer add: 16: 60000:2825487964
> 10085#0: rtsig add connection: fd:6 signo:43
> 10085#0: *741 post event 0825030C
> 10085#0: *741 delete posted event 0825030C
> 10085#0: *741 http upstream process header
> 10085#0: *741 malloc: 08230A98:4096
> 10085#0: *741 malloc: 08231AA0:4096
> 10085#0: *741 recv: fd:16 128 of 4096
> 10085#0: *741 http fastcgi record byte: 01
> 10085#0: *741 http fastcgi record byte: 06
> 10085#0: *741 http fastcgi record byte: 00
> 10085#0: *741 http fastcgi record byte: 01
> 10085#0: *741 http fastcgi record byte: 00
> 10085#0: *741 http fastcgi record byte: 64
> 10085#0: *741 http fastcgi record byte: 04
> 10085#0: *741 http fastcgi record byte: 00
> 10085#0: *741 http fastcgi record length: 100
> 10085#0: *741 http fastcgi parser: 0
> 10085#0: *741 http fastcgi header: "Status: 404 Not Found"

And PHP sends 404.
Probably it tries to work with

fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_script_name;

or

fastcgi_param  REQUEST_URI        $request_uri;

Try to delete them and use

fastcgi_param  SCRIPT_FILENAME  $document_root$script_name;
fastcgi_param  PATH_INFO        $path_info;

only.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list