7

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

3 Answers 3

8

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;
    }
}
Sign up to request clarification or add additional context in comments.

5 Comments

Even if i change the root directive out of the server block i wont make a dirrerence...
I have added an example.
Should i use the non threat safe or threat safe php version?
@Yooouuri I am not familiar with Windows or php-cgi.
No problem. I moved the root and ìndex directive from the location / to the server block and everything works. Thanks for your help.
3

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

1 Comment

+1 I searched high and low, and it turns out the lack of an absolute path was the problem. Use forward slashes!
1

May be the root path problem. I used the backslash \ on Windows and found this issue.

 server {
     location ~ \.php$ {
-         root C:\Users\name\ProjectOfPHP; # 404
+         root C:/Users/name/ProjectOfPHP; # Use this pattern
     }
 }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.