Problem with fastcgi_split_path_info on ubuntu precise

zakaria nginx-forum at
Sat May 4 23:41:43 UTC 2013

Francis Daly Wrote:
> On Fri, May 03, 2013 at 09:44:14PM -0400, zakaria wrote:

> Hi there,

> What output do you expect?

> And if it not obvious: how does that differ from this output?

> I *think* you're reporting that PATH_INFO is unexpectedly empty
> in $_SERVER, in which case adding "fastcgi_param TEST_PATH_INFO
> $fastcgi_path_info;" and retrying might give a hint as to where the
> problem is.

> 	f
> -- 
> Francis Daly        francis at daoine.orgYes, that's what I mean.

I'm sorry for being cryptic but this problem has me puzzled for two days.

Let me tell the long story.
I'm trying to setup a web server using nginx in ubuntu 12.04.2 (precise)
Like any good sysadmin, I use bash script to setup everything.
So I could replay it anytime.

So on the friday I rerun the script (to enhanced it) and it didn't work like
it used to.
I swear, I got nginx working perfectly before with PATH_INFO and all.

To answer your question. The PATH_INFO should output to '/foo/bar.php'

Per your request here's my modified config
        location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param TEST_PATH_INFO    $fastcgi_path_info;
                try_files $fastcgi_script_name =404;

                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

And the result with cgi.fix_pathinfo = 1 (the default)
array (
  'USER' => 'www-data',
  'HOME' => '/var/www',
  'PATH_INFO' => '',
  'TEST_PATH_INFO' => '',
  'QUERY_STRING' => '',
  'CONTENT_TYPE' => '',
  'SCRIPT_FILENAME' => '/var/www/test.php',
  'SCRIPT_NAME' => '/test.php',
  'REQUEST_URI' => '/test.php/foo/bar.php',
  'DOCUMENT_URI' => '/test.php',
  'DOCUMENT_ROOT' => '/var/www',
  'SERVER_SOFTWARE' => 'nginx/1.4.0',
  'REMOTE_ADDR' => '',
  'REMOTE_PORT' => '33683',
  'SERVER_ADDR' => '',
  'SERVER_PORT' => '80',
  'SERVER_NAME' => '',
  'HTTPS' => '',
  'REDIRECT_STATUS' => '200',
  'HTTP_HOST' => 'lemp.test',
  'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:20.0)
Gecko/20100101 Firefox/20.0',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
  'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
  'HTTP_CONNECTION' => 'keep-alive',
  'HTTP_CACHE_CONTROL' => 'max-age=0',
  'PHP_SELF' => '/test.php',
  'REQUEST_TIME' => 1367710298,

So here's my request to you all:
1. Is my config correct? I'm sure it is.
2. Could you try it on your system and
   tell me whether the output differ from mine?
3. Is there something wrong on the latest ubuntu precise?
   Or is it just my imagination that I have it working before? :)


Posted at Nginx Forum:,238825,238849#msg-238849

More information about the nginx mailing list