About Solution ThinkPHP in Nginx server error due PATH_INFO

Reference: https://www.linuxidc.com/Linux/2011-11/46871.htm

 

It is a question ningx settings, and TP-independent. TP default PATH_INFO do CURD, but nginx default settings do not handle PATH_INFO, see the nginx can see the error log:
2010/01/09 22:05:36 [error] 13988 # 9380: * 3 CreateFile () "E: \ company \ home \ labs \ php \ thinkphp \ server \ nginx-0.8.31 / .. \ .. \ src / Examples / Form / index.php / Index / insert "failed (3: The system can not find the path specified) , Client: 127.0.0.1, Server: localhost, Request: "POST  /Examples/Form/index.php/Index/insert  HTTP / 1.1", Host: "localhost", referrer: "HTTP: // localhost / Examples / Form / "
explained the PATH_INFO nginx as a part of the catalog file, so the file can not be found.

Solution one: TP modify settings, do not use PATH_INFO

Solution two: nginx modify settings, support PATH_INFO

I use CoreServer integrated package this as an example, www.linuxidc.com modify nginx.conf and fastcgi-params

the
       location ~ \ .php $ {
modify
       LOCATION ~ \ .php / ?.


         fastcgi_param   SCRIPT_FILENAME   $document_root2$fastcgi_script_name;
修改为
         set $fastcgi_script_name2 $fastcgi_script_name;
         if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
            set $fastcgi_script_name2 $1;
            set $path_info $2;
         }
         fastcgi_param   PATH_INFO $path_info;

         fastcgi_param   SCRIPT_FILENAME   $document_root2$fastcgi_script_name2;


fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
修改为
fastcgi_param   SCRIPT_NAME        $fastcgi_script_name2linux

Guess you like

Origin www.cnblogs.com/iitrust/p/12332999.html