Home  >  Article  >  Backend Development  >  How to solve Nginx not parsing php

How to solve Nginx not parsing php

小云云
小云云Original
2018-03-27 08:59:226216browse

This article mainly shares with you how to solve the problem of Nginx not parsing PHP. I hope it can help everyone.

Solution:

1./etc/php5/cgi/php.ini
/etc/php5/fpm/php.ini

Modify php.ini cgi.fix_pathinfo=1

2 in the file, modify the nginx.conf file

  1. location ~ \.php$ {  
              root           html;  
              fastcgi_pass   127.0.0.1:8000;  
              fastcgi_index  index.php;  
              #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
              fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name; //给出文件的真实路径
              include        fastcgi_params;  
           }

3, start

spawn- fcgi -a 127.0.0.1 -p 8000 -C 10 -u nobody -f /usr/bin/php-cgi

##/etc/init.d/php5-fpm start

/etc/inti.d/nginx start

Related recommendations:

Comprehensive analysis of how to install yar extension in php7

Analysis of PHP Dependency injection methods

Analysis of PHP dependency injection and control inversion

The above is the detailed content of How to solve Nginx not parsing php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn