$ _SERVER ['PHP_SELF']错误链接,双链接

$_SERVER['PHP_SELF'] gives the wrong link and because of that some scripts don't work correctly

For example, I put the following code in the file test.php:

<?
echo $_SERVER[PHP_SELF];
echo "<br>" ;
echo $_SERVER['PHP_SELF'];
?>

In root folder, like www.site.ru/test.php, I see:

/test.php/test.php
/test.php/test.php

Must be just /test.php... why does that happen?

Php version:

php.i686 0:5.3.16-9
php-cli.i686 0:5.3.16-9 
php-common.i686 0:5.3.16-9
php-devel.i686 0:5.3.16-9
php-fpm.i686 0:5.3.16-9
php-pdo.i686 0:5.3.16-9
php-sqlite.i686 0:5.3.16-9
php-xml.i686 0:5.3.16-9
php-mysql.i686 0:5.3.16-9
php-mcrypt.i686 0:5.3.16-9
php-mbstring.i686 0:5.3.16-9
php-intl.i686 0:5.3.16-9
php-gd.i686 0:5.3.16-9 

cgi.fix-pathinfo

I was have the same problem , after lot of search found the fix for my problem also sure for you too

I use nginx/1.10.2 with PHP 5.6.29 with PHP-FPM

var_dump($_SERVER["PHP_SELF"]); = 'string(32)"/test/index3.php/test/index3.php"'

to fix , edit php.ini cgi.fix_pathinfo make sure its equal 0

cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for CGI. PHP's previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting of zero causes PHP to behave as before. Default is 1. You should fix your scripts to use SCRIPT_FILENAME rather than PATH_TRANSLATED. http://php.net/cgi.fix-pathinfo

cgi.fix_pathinfo=0

after fix the problem

should restart nginx and php-fpm

var_dump($_SERVER["PHP_SELF"]); = 'string(16) "/test/index3.php"'