: This article describes how to use the pathinfo mode of ThinkPHP on the Nginx server. if you are interested in the PHP Tutorial, refer to it. The pathinfo mode of thinkphp cannot be used after one-click LNMP installation and packaging.
Baidu once found that pathinfo is enabled in the nginx/conf/vhost/domain name file, so pathinfo is started.
But the project still cannot run, so I ran the code both locally and on the server:
The difference between PHP_SELF and so may be found here.
Search PHP_SELF in the project and find the file:
ThinkPHP. php
If (IS_CGI) {// CGI/FASTCGI mode $ _ temp = explode ('. php ', $ _ SERVER ['php _ SELF']); define ('_ PHP_FILE _', rtrim (str_replace ($ _ SERVER ['http _ host'], '', $ _ temp [0]. '. php '),'/');} else {define (' _ PHP_FILE _ ', rtrim ($ _ SERVER ['script _ name'], '/'));}
That is, ThinkPHP depends on PHP_SELF in cgi mode. The problem is true here.
In the end, Baidu again. it was originally set in php. ini to block a vulnerability:
cgi.fix_pathinfo=0
It is precisely because of this row setting that the PHP_SELF value is deviated.
However, pathinfo. conf in the LNMP integration package has been used.
try_files $fastcgi_script_name =404
Solve this vulnerability, so we can modify php. ini
cgi.fix_pathinfo=1
Restart the server, OK, and solve the problem