Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx, fastcgi PHP Windows, No input file specified

Tags:

nginx

fastcgi

Running php-cgi on port 9000

Netstat gives me

TCP 127.0.0.1:9000 DESKTOP-xxxxxxx:0 LISTENING [php-cgi.exe]

nginx.conf

http://pastebin.com/wkfz8wxw

Every php file gives me this No input file specified. error...

Changed SCRIPT_FILENAME to SCRIPT_NAME and no succes..

I am on Windows 10 Home x64

like image 628
yooouuri Avatar asked Jan 28 '16 00:01

yooouuri


2 Answers

You need to set a document root with the root directive, either within your location ~ \.php$ block or inherited from the outer server block.

The solution may be to move the root c:/Users/Youri/PhpstormProjects; line out of your location / block into a position above it.

Usually fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; is the correct method to specify the full path to the script, whereas SCRIPT_NAME is usually just the last element.

Like this:

server {
    ...

    root   c:/Users/Youri/PhpstormProjects;

    location / {
        index  index.html index.htm index.php;
    }

    location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include       fastcgi_params;
    }
}
like image 139
Richard Smith Avatar answered Sep 28 '22 15:09

Richard Smith


Set root directive with absolute path in windows PC. Check for the case or any typing mistake in the path. Reload the nginx process.

like image 31
Engr Syed Rowshan Ali Avatar answered Sep 28 '22 15:09

Engr Syed Rowshan Ali