Nginxphp blank page fastcgi_param_PHP tutorial

Source: Internet
Author: User
The blank nginxphp page fastcgi_param. After nginx is installed today, you will find that the html page can be viewed normally. However, after the page of the php file is opened, the page is blank. you can view the php-fpm log, and check the nginx log. The problem is found online. after searching for a long time, the installation is complete. nginx finds that the html page can be browsed normally, but the page of the php file is blank after it is opened. Looking at the php-fpm log, the nginx log is not found.

After searching for the Internet for half a day, I finally made a record here.

A saying on the internet is that such a sentence is missing in the nginx configuration file.

Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

In fact, he defines the SERVER variables used in php, that is, $ _ SERVER.

There is such a sentence under the http://wiki.nginx.org/NginxHttpFcgiModule URL

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

In fact, the server is like your processing of php cgi to pass some of the parameters that he needed in the past, but at least two of the following parameters can be executed in php.

Below is an example of 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 parameters of the request.

So php cannot explain the execution without defining the system variable SCRIPT_FILENAME.

The definition of this variable can be written in the nginx configuration file nginx. conf or in the nginx. conf file by using the include method externally.

After seeking, I found that the html page could be browsed normally. However, after opening the page of the php file, I read the php-fpm log, but I still couldn't find the nginx log. after searching online for a long time, I finally got it...

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.