Nginx PHP blank Page fastcgi

Source: Internet
Author: User

Today after the installation of Nginx found HTML page can be normal browsing, but the PHP file page Open is a blank look php-fpm log see Nginx Log did not find the problem

Internet search for half a day finally solved, in this make a record memo

One of the sayings on the Internet is the lack of such a word in the Nginx configuration file

Fastcgi_param script_filename $document _root$fastcgi_script_name;

What is that? In fact, he is the definition of PHP used in the server variable is $_server

Http://wiki.nginx.org/NginxHttpFcgiModule This web site there is a word

This module allows Nginx to interact with FastCGI processes and control what parameters are to the process.

In fact, the server, like your PHP CGI, delivers some of the parameters he needs in the past, and at least one of the following two parameters PHP can be executed

Below is a example the minimally necessary parameters for PHP:

Fastcgi_param Script_filename/home/www/scripts/php$fastcgi_script_name;

Fastcgi_param query_string $query _string;

Parameter Script_filename is used by PHP for determining the name of SCRIPT to execute, and Query_string contains the Para meters of the request.

So we're not going to be able to explain the execution of PHP without defining the SCRIPT_FILENAME system variable.

The definition of this variable can be written in the Nginx configuration file nginx.conf can also be written externally in the nginx.conf included in the form.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.