﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
509	fastcgi_split_path_info Unsetting $fastcgi_path_info with Try_Files	Mark Johnson		"When using a try_files inside a location block that will be using PHP-FPM the ""fastcgi_split_path_info"" method does NOT properly save the $fastcgi_path_info variable. With the try_files directive removed, the $fastcgi_path_info is set properly.


{{{
	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;

		# Define the results as fastcgi parameters for quick 
		# verification/debug via <?php print_$(SERVER); ?>
		fastcgi_param FASTCGI_SCRIPT_NAME	$fastcgi_script_name;
		fastcgi_param FASTCGI_PATH_INFO		$fastcgi_path_info;

		# FASTCGI_PATH_INFO reports blank when using try_files.
		try_files $fastcgi_script_name =404;

		# Alternatively, using an ""evil-if"" will result in the variables being set correctly.
		#if (!-f $document_root/$fastcgi_script_name) {
		#	return 404;
		#}

		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		# ...
	}
}}}


----

'''TO REPRODUCE'''

1. Include the above location block in the default site (making changes where appropriate)

2. Update/create the index.php as follows at the default server root on a clean Nginx install.
{{{
<?php
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
?>
}}}

3. Restart nginx.

4. Navigate to:
{{{
/index.php/foo/bar.php?param=1
}}}

5. Expected Results Using '''try_files'''
{{{
Array
(
	[FASTCGI_SCRIPT_NAME] => /index.php
	[FASTCGI_PATH_INFO] => /foo/bar.php
)
}}}

6. Actual Results Using '''try_files'''
{{{
Array
(
	[FASTCGI_SCRIPT_NAME] => /index.php
	[FASTCGI_PATH_INFO] =>
)
}}}"	defect	closed	minor		nginx-core	1.4.x	duplicate	fastcgi_path_info, fastcgi_split_path_info		Linux NGINX-TEST-01 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux , Linux NGINX-TEST-02 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux	"nginx/1.4.1 (Ubuntu) , nginx/1.2.1
"
