Nginx+php the presence of no input file specified error how to resolve

Source: Internet
Author: User

Today in your own local development environment suddenly appeared no input file specified error, repeatedly check the return to their own configuration files and configuration path and permissions are no problem. After repeated investigation finally found the problem, this article mainly share with you nginx+php no input file specified error How to solve, hope to help everyone.

Problem cause Analysis

Download an open source TP5 project on GitHub, and it's no problem to run your own local site. However, after installing this open source project, it is found that other local sites are inaccessible. Access is no input file specified error. On the Internet to find a solution, but none, it seems a bit strange mistake.
After repeated attempts to restart the computer after the problem is resolved but again to run the downloaded TP5 Open source project after the other Web site again the error no input file specified and only this one site run no problem.
The error is then delineated in the Nginx configuration file for the open source project. Then take a look at the configuration file:

server {Listen 80;    server_name local.test.com;    Access_log/data/wwwlogs/local.test.com.log combined;    Error_log/data/wwwlogs/local.test.com_error.log error;    Index index.html index.htm index.php;    Root/data/php/test;    Add_header X-powered-host $hostname;    Fastcgi_hide_header x-powered-by; if (!-e $request _filename) {rewrite ^/(. +?\.php)/? (.        *) $/$1/$2 last;    Rewrite ^/(. *) $/index.php/$1 last;        } location ~ \.php ($|/) {Fastcgi_index index.php;        Fastcgi_pass 127.0.0.1:9000;        Include Fastcgi_params;        Set $real _script_name $fastcgi _script_name;        if ($real _script_name ~ "^ (. +?\.php) (/.+) $") {set $real _script_name $;        } fastcgi_split_path_info ^ (. +?\.php) (/.*) $;        Fastcgi_param path_info $fastcgi _path_info;        Fastcgi_param script_name $real _script_name;        Fastcgi_param script_filename $document _root$real_script_name; Fastcgi_param Php_value Open_basediR= $document _root:/tmp/:/proc/; } location ~. *\.        (gif|jpg|jpeg|png|bmp|swf) $ {access_log off;        Error_log off;    Expires 30d; } location ~. *\.        (JS|CSS)? $ {Access_log off;        Error_log off;    Expires 12h; }

In the above configuration, the other is the general configuration. Because I use CGI. There is a line in the fastcgi parameter that you might notice.

Fastcgi_param php_value open_basedir= $document _root:/tmp/:/proc/;

That's the sentence. The main function of this sentence is to set the operational directory of FASTCGI to prevent cross-site, Open_basedir is limited to the project directory and/tmp/and/proc/.

Problem solving

Just said it was in the configuration of the fastcgi configuration there is an extra sentence to prevent cross-site statements. Then he actually affected the entire fastcgi parameter, so because my other site's path is/data/php/xxx/such a directory, and not in this open source project directory/data/php/test/so FastCGI can't find.
So before this sentence add the comment or delete this sentence to restart the system or restart the Nginx.

Recommendations for on-line deployment

So, do you want to use this sentence anyway? In the online environment of course it is possible. It is best not to use variables such as $document_root for Open_basedir in project deployment online. If there are multiple projects online on the server then it is possible to put the project in a unified directory. For example my online is the Wwwroot directory where other sites are placed. For example/wwwroot/test1/wwwroot/test2 so I can configure the

Fastcgi_param Php_value open_basedir=/wwwroot/:/tmp/:/proc/;
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.