Home >Backend Development >PHP Tutorial >Nginx PHP returns 200, but blank page_PHP tutorial

Nginx PHP returns 200, but blank page_PHP tutorial

WBOY
WBOYOriginal
2016-07-22 09:02:372096browse

ngxin; After php-fpm is installed, the html static page is fine, but although the phpinfo page returns 200, it is always a blank page

There is no error. It is considered that nginx has transferred the php page to php for processing, so the problem should be in the configuration of php. After searching, I found that I need to add a sentence to nginx
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

After installing nginx, the default fastcgi_params configuration file does not have the above sentence.

In nginx.conf
location ~ .php$ {
root Fastcgi_pass 127.0.0.1:9000 ;
                   fastcgi_index index.php;
                 #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Include fastcgi_params;
        }
Or add it to the fastcgi_params configuration file
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Then restart nginx to display the page.

http://www.bkjia.com/PHPjc/371851.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371851.htmlTechArticle After ngxin;php-fpm is installed, the html static page is fine, but although the phpinfo page returns 200, it is always a blank page without any error. It is considered that nginx has transferred the php page to...
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