centos+nginx+php-fpm+php include fastcgi_params PHP page can be accessed but blank, Fastcgi_params and fastcgi.conf disaster.

Source: Internet
Author: User
Tags blank page
Today, this is a piece of work on CentOS. When you visit a page all the time, the browser prompts you to be OK. And accessing the HTML suffix is the normal occurrence of the content.

However, the access to the PHP suffix is returned to a blank page, while viewing all logs did not find any error messages;

Again in the nginx.conf in the server to write if the path does not exist on the return 405 such a sentence to debug, found that my configuration or normal can go to that 405.

Just no content to return ....

For a few hours. The head was almost dizzy.

I still haven't figured out what's going on.

Finally think and compare the next Fastcgi_params and Fastcgi.conf, the head has been dizzy, looked at a few eyes, did not see the difference.

I'm going to include the params file, not conf. I'm so depressed. What's going on?

And think about it. Do you want to try a diet conf this?

A change. Refresh the page, unexpectedly out of the content ...

Look back at the eyes two files. Unexpectedly still did not find what difference .... It's all dizzy.

Use two filenames on the internet to find out, only to find that these two files are really different;

And there's a history.

Fastcgi_params VERSUS FASTCGI. CONF? Nginx CONFIG historytweetthe nginx Source Install (and by extension package managers) includes, FastCGI configuration F Iles, Fastcgi_params and fastcgi.conf that differ only a tiny bit. To the They still cause confusion amongst new users due to the package managers. The difference between the both files in the source install are the simple line Of:fastcgi_param script_filename $document _r Oot$fastcgi_script_name; The difference between the "the" and the "distributions" package repositories are nothing, they essentially modified fast Cgi_params to match Fastcgi.conf.What this line does are tell PHP which file it should execute, without this nginx and PHP Cannot work together. This sounds like a good line to include in the shipped FastCGI configuration file and indeed Igor Sysoev thought so as wel L. However, due to the configurations of the time this wasn ' t as easy as simply adding it in. Back in the days of 0.6.x when I started using nginx and a few yeaRs before happened a typical configuration example would look like This.location ~ \.php$ {include fastcgi    _params;    Fastcgi_param Script_filename/var/www/foo$fastcgi_script_name; Fastcgi_pass backend;}  Due to Community documentation efforts on the Wiki people slowly started using the $document _root variable instead of hard Coding the root path, however, many people were still using the above configuration many years later. Because of how arrays directives inherit and interact the people using the old configuration style made it impossible Clude the line in Fastcgi_params.  Doing This would has meant that Script_filename would be defined twice and both would is sent to the backend, potentially causing confusing behaviour. In 0.8.30 (released:15th of December) Igor then included fastcgi.conf which is the same as Fastcgi_params except in Cluding the improved Script_filename fastcgi_param. This meant, the community could now start recommending people Include fastcgi.conf instead of recommending moving Script_filename into Fastcgi_params. New articles on the wiki mostly used this, the popular articles were slowly changed to use it and we were promoting it in The IRC support channel.  Of course, an issue-then-was, the package managers gave Nginx very little love and were many versions behind, usually Something like 0.6.x versus 0.8.x. The fastcgi.conf file is not included for these people.  When they eventually do update they shipped with a fastcgi.conf and a modified fastcgi_params leaving us with a situation Where the source is install actually differed from the repository install in a non-significant. While isn't often, this does still cause the occasional confusing in the IRC channel. As an aside, I actually Preferfastcgi_param script_filename $request _filename;as It takes the alias directive to account , fastcgi_new.conf anyone? Last Updated:sunday, July 7, 2013

I understand that the above statement is:

A long time ago, everyone was include fastcgi_params, and in the back add a sentence

Fastcgi_param Script_filename/var/www/foo$fastcgi_script_name;
Because this command is an array pattern, it does not say that the same name of the instruction, the back will replace the front.

And nginx developers slowly found that everyone wrote dead this root has a problem. or inconvenient?

So give a plan, or, in front of the time, that block can not write variables? Is it hard coded to write dead?

We can do it later. But it is estimated that many people are still old, and if you add this sentence directly to the previous word of the params file, it may appear in the same time as nginx.conf, two times. It leads to a lot of inexplicable problems,

It is possible that some places will use the path of the previous instruction, and the other place may use the following instruction.

So, the author retains the params, and the new file is called fastcgi.conf.

And I just happen to understand that these two files are the same ... However, because this command is not provided, no files are sent to the PHP gate. Then, the blank content was returned;;;;;;;

I was dizzy .... A few hours ... A period of history ... If I add a few notes on the fastcgi.conf to make careless, I will not be so miserable without looking carefully ....

  • Related Article

    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.