Today, the error "No input file specified" suddenly appeared in my local development environment. I checked my configuration files, configuration paths, and permissions repeatedly and found that there were no problems. After repeated investigations, the problem was finally found. The problem and solution are shared as follows: Cause Analysis I downloaded an open source tp5 project from GitHub, and my local website had no problems running before. However, after installing this open source project, I found that other local websites were inaccessible. Access is No input file specified error. I also looked for solutions on the Internet, but none of them worked. It seems that this error is a bit strange. After repeated attempts, the problem was solved after restarting the computer. However, after running the downloaded tp5 open source project again, other websites showed the error No input file specified, and only this one website ran without any problems. Based on this, the error was localized in the nginx configuration file of the open source project. Let's 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 $1; } 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 rest are conventional configurations. Because I use cgi. There is a line in the fastcgi parameters that you may have noticed. fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/; That's it. The main function of this sentence is to set the operable directory of fastcgi to prevent cross-site, and limit open_basedir to the directory of this project and /tmp/ and /proc/. Problem Solving I just said that there is an additional statement to prevent cross-site in the configured fastcgi configuration. Then this sentence actually affects the parameters of the entire fastcgi. Because the path of my other website is a directory like /data/php/xxx/, but not in the directory /data/php/test/ of this open source project, fastcgi cannot be found. Online deployment recommendations So should we use this sentence or not? Of course it is possible in an online environment. In online project deployment, it is best not to use variables such as $document_root in open_basedir. If there are multiple projects in an online server, all projects can be placed in a unified directory. For example, my online directory is wwwroot where other websites are placed. For example, /wwwroot/test1 /wwwroot/test2, I can configure it as fastcgi_param PHP_VALUE open_basedir=/wwwroot/:/tmp/:/proc/; The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed installation tutorial for MySQL zip archive version (5.7.19)
>>: mysql5.7.19 zip detailed installation process and configuration
1. Introduction tr is used to convert or delete a...
When it comes to understanding web design, many p...
Shtml and asp are similar. In files named shtml, s...
Table of contents Preface 1. Get the current time...
1. Check whether the check status module is insta...
First, check whether the hard disk device has a d...
console.log( [] == ![] ) // true console.log( {} ...
This article shares the specific code of JS to ac...
Table of contents 1. Declare a function 2. Callin...
I plan to use C/C++ to implement basic data struc...
Table of contents Preliminary Notes Problem Repro...
VMware12.0+Ubuntu16.04+MySQL5.7.22 installation t...
Vue3 project encapsulation side navigation text s...
The bash history command in Linux system helps to...
1. Dynamically loading scripts As the demand for ...