Home >Backend Development >PHP Problem >What should I do if index.php is not parsed when accessing it?
The solution to accessing index.php without parsing is to configure a piece of code in the nginx server as "location ~ \.php$ {try_files $uri =404;fastcgi_split_path_info ^(. .php)...}" That’s it.
The operating environment of this article: Windows7 system, PHP5 version, DELL G3 computer
What should I do if index.php is not parsed when accessing it?
nginx server does not parse PHP when accessing, and directly downloads the PHP file
When configuring the server, this situation sometimes occurs. Map the domain name to the directory and access the The domain name directly downloads the index.php file. How to solve this situation?
location ~ \.php$ { try_files $uri =404; #增加 fastcgi_split_path_info ^(.+.php)(/.+)$; #反注释 ## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # ## With php5-cgi alone: #fastcgi_pass 127.0.0.1:9000; ## With php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; #反注释 fastcgi_index index.php; #反注释 include fastcgi_params; #反注释 # include snippets/fastcgi-php.conf; # # # With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; }
Just configure this piece of code in the nginx server to parse PHP. The purpose of this code is to automatically jump to php5-fpm to parse the file when accessing a php file.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if index.php is not parsed when accessing it?. For more information, please follow other related articles on the PHP Chinese website!