PHP $_SERVER['SCRIPT_NAME'] is wrong when loading PHP via mod_fcgid

前端 未结 1 708
长发绾君心
长发绾君心 2021-01-15 03:33

I\'m using Apache 2.4.7 and PHP 5.5.7.

I have a test.php file in C:\\web\\vhosts\\Symfony\\web.

The value of $_SERVER[\'SCRIP

1条回答
  •  广开言路
    2021-01-15 03:56

    Now I know what's wrong:

    FcgidFixPathinfo 1
    

    Set this value to 0. You can also comment it out, or remove it altogether, since 0 is the default.


    According to the documentation:

    This directive enables special SCRIPT_NAME processing which allows PHP to provide additional path information. The setting of FcgidFixPathinfo should mirror the cgi.fix_pathinfo setting in php.ini.

    However I found that the value of cgi.fix_pathinfo in the php.ini file makes absolutely no influence as to the value of $_SERVER['SCRIPT_NAME']:

    • When FcgidFixPathinfo is set to 0 in the httpd.conf file, $_SERVER['SCRIPT_NAME'] is correct (/test.php), regardless of the value of cgi.fix_pathinfo in the php.ini file.

    • When FcgidFixPathinfo is set to 1 in the httpd.conf file, $_SERVER['SCRIPT_NAME'] is incorrect (C:/test.php), regardless of the value of cgi.fix_pathinfo in the php.ini file.

    0 讨论(0)
提交回复
热议问题