Error "No input file specified" (wrong fastcgi_param?)

Hello Everyone -

I’ve installed nginx-0.6.33 + php-5.2.6 + php-fpm-0.5.9 + xcache-1.2.2
under Debian 4.0 (Etch) on a VPS (virtual private server), using the
instructions here:

http://wiki.codemongers.com/NginxFullExample
http://www.yawn.it/2008/04/30/nginx-php-php-fpm-on-debian-etch-40/
http://firedemon.su/?p=200 ( к счастью учил русский язык давно в
колледже :slight_smile:
NameBright - Coming Soon


Now my browser can display index.html with no problem:

$ cat /usr/local/nginx/html/myvhost1.com/index.html

… Welcome to myvhost1.com

But when I try to display index.php…

$ cat /usr/local/nginx/html/myvhost1.com/index.php

<? phpinfo(); ?>

…my browser displays the following error:

No input file specified.


As a further test, I deliberately entered some bad pages:

http://myvhost1.com/bad-page.html

404 Not Found
nginx/0.6.33

http://myvhost1.com/bad-page.php

No input file specified.


Here’s my nginx.conf file:

$ cat /usr/local/nginx/conf/nginx.conf

user www-data www-data;
worker_processes 2;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local]

$request ’
# '“$status” $body_bytes_sent “$http_referer” ’
# ‘“$http_user_agent” “$http_x_forwarded_for”’;

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

gzip on;
gzip_comp_level 1; gzip_proxied any;
gzip_types text/plain
           text/html
           text/css
           application/x-javascript
           text/xml
           application/xml
           application/xml+rss
           text/javascript;

server {
    listen       80;
    server_name  .myvhost1.com;

    location / {
        root   html/myvhost1.com;
        index  index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   html;
    }

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include /usr/local/nginx/conf/fastcgi_params;
    }
}

}


And here’s my fastcgi_params file (I added the line at the end):

$ cat /usr/local/nginx/conf/fastcgi_params

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

I ADDED THIS LINE

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


I’m new to all this so I don’t know what I’m doing wrong here.

I’d appreciate any ideas you might have.

Thanks.

  • Stefan S.

PS - Here is the directory listing showing that file ‘index.php’ does
exist (and page ‘bad-page.php’ does not exist) - along with the
permissions, in case that’s any help:

$ ls -l /usr/local/nginx/html/myvhost1.com
total 12
-rw-r–r-- 1 root staff 383 2008-11-27 15:13 50x.html
-rw-r–r-- 1 root staff 146 2008-11-27 15:17 index.html
-rw-r–r-- 1 root staff 17 2008-12-01 01:30 index.php

The file /usr/local/nginx/html/myvhost1.com/index.php does exist and the
file /usr/local/nginx/html/myvhost1.com/index.php does not exist - but
in both cases the browser gives the message “No input file specified.”

I’m sure this is a simple error I’m making involving one of the
fastcgi_param values, but I don’t know how to fix it!

Also, in case this helps, here is a portion of my
/usr/local/etc/php-fpm.conf file:

/usr/local/etc/php-fpm.conf

THE BELOW HAVE BEEN UPDATED AS SHOWN, FOLLOWING THE INSTRUCTIONS AT:

http://www.yawn.it/2008/04/30/nginx-php-php-fpm-on-debian-etch-40/

http://firedemon.su/?p=200 ( ? ??? ??? ??? ??? ??? ?

LINES 40-42

Address to accept fastcgi requests on.
Valid syntax is ‘ip.ad.re.ss:port’ or just ‘port’ or
‘/path/to/unix/socket’
127.0.0.1:9000

LINES 63-67

Unix user of processes
www-data

Unix group of processes
www-data

Hi,

I want to filter out the following requests

nginx: 127.0.0.1 - - [01/Dec/2008:13:10:15 +0100] “-” 400 0

I want to filter it out with a location match

location = - {
access_log off;
return 444;
}

This doesn’t work, any other method to match a “-” request?

Regards
Marlon

On Mon, Dec 01, 2008 at 01:15:28PM +0100, Marlon de Boer wrote:

This doesn’t work, any other method to match a “-” request?

No, this does not work as “-” in access_log means no request line at
all.

You need to either put

root html/myvhost1.com;

inside your php location block or define it in the server block and
don’t worry about putting it in your location / block. Personally i
would get ride of the location / block and define root and index
server wide. so in cases if you have
location /somedir {
}

you won’t have to redefine root and index there also.

Rob

hiya :
Now I use the Nginx 7.x +tomcat 6.x
I have some application should use post method to request tge static
page
but always filed i use the httpwatch to catch the package ,I find the
url give the 405 code
what should I do?
thanks

If I understand correctly, I had the same problem and solved it using
this:
server {

location / {
if ($request_method = POST) {
proxy_pass http://upstream_server;
break;
}

}
}

This is the first “if” statement in in my “location” directive. If the
request is a post, it is automatically sent to the app server and cached
files are ignored even if they exist.

Hope that helps.

Nick

2008/12/1 曹 æµ·å³° [email protected]

On Mon, Dec 01, 2008 at 08:58:42PM +0800, ?? ???p wrote:

hiya :
Now I use the Nginx 7.x +tomcat 6.x
I have some application should use post method to request tge static page
but always filed i use the httpwatch to catch the package ,I find the url give the 405 code
what should I do?
thanks

What should static page do with a POST request ?

thanks !
I will try it tomorrow

Date: Mon, 1 Dec 2008 08:20:47 -0600From: [email protected]:
[email protected]: Re: about use post method to request the static
pageIf I understand correctly, I had the same problem and solved it
using this:

server {

location / {
if ($request_method = POST) {
proxy_pass http://upstream_server;
break;
}

}
}

This is the first “if” statement in in my “location” directive. If the
request is a post, it is automatically sent to the app server and cached
files are ignored even if they exist.

Hope that helps.

Nick

2008/12/1 曹 æµ·å³° [email protected]

hiya : Now I use the Nginx 7.x +tomcat 6.x I have some application
should use post method to request tge static page but always filed i
use the httpwatch to catch the package ,I find the url give the 405
codewhat should I do?thanks

下載 Windows Live Messenger 8.5 最新版,多元溝通、盡情分享,和即時傳訊好友線上同樂!— 立即下載

For me I wanted this so that forms on my sites could be posted to the
same
URL that was used to request the page. Specifically, I didn’t want the
user
to be taken to a different URL when there were form post errors, and I
didn’t want the server to issue a redirect back to the original URL to
show
an error message to the user.
For example, if the user is at mysite.com/contact and submits a form
without
filling out a required field, I wanted the user to remain at that
location
while viewing the error message and without a redirect. The only way I
knew
to do this was to set the form’s action attribute to the “static” page’s
location (the current URL) and have nginx do a pass-through for form
posts.

I should mention that my requirements might be different from what
Dennis
Cao (?) is trying to do. I’ve written a content management system that
caches pages at the request path when it receives “get” requests, so
although my contact page is “static”, it may or may not exist before the
request is made. As such, even for this static page, the “get” request
may
be passed through to the CMS anyway.

And because I wanted my application to have complete control over how
“post”
requests are handled, I configured nginx to pass all post requests
through
to the application regardless of the URL that was posted to.

I am sorry ,i do not know why the the developer use this method
But this is must to be used> Date: Mon, 1 Dec 2008 17:24:06 +0300> From:
[email protected]> To: [email protected]> Subject: Re: about use post
method to request the static page> > On Mon, Dec 01, 2008 at 08:58:42PM
+0800, ?? ???p wrote:> > > hiya :> > Now I use the Nginx 7.x +tomcat
6.x> > I have some application should use post method to request tge
static page > > but always filed i use the httpwatch to catch the
package ,I find the url give the 405 code> > what should I do?> >
thanks> > What should static page do with a POST request ?> > > – >
Igor S.> http://sysoev.ru/en/>

You may have a local process that is polling nginx to see if port 80
is open then droping the connection.

One solution is to setup a default host seperate from your main vhosts
and then disable access logging for that host.

Cheers dave

the java program is working well with apache !but i would like to use
the nginx

From: [email protected]: [email protected]: RE: about use
post method to request the static pageDate: Mon, 1 Dec 2008 23:25:26
+0800

I am sorry ,i do not know why the the developer use this methodBut this
is must to be used> Date: Mon, 1 Dec 2008 17:24:06 +0300> From:
[email protected]> To: [email protected]> Subject: Re: about use post
method to request the static page> > On Mon, Dec 01, 2008 at 08:58:42PM
+0800, ?? ???p wrote:> > > hiya :> > Now I use the Nginx 7.x +tomcat
6.x> > I have some application should use post method to request tge
static page > > but always filed i use the httpwatch to catch the
package ,I find the url give the 405 code> > what should I do?> >
thanks> > What should static page do with a POST request ?> > > – >
Igor S.> http://sysoev.ru/en/>

聰明搜尋和瀏覽網路的免費工具列 — Windows Live 搜尋工具列

Hello -

A solution has been provided on another forum, by
Andrei Nigmatulin (the creator of PHP-FPM):

http://groups.google.com/group/highload-php-en/browse_thread/thread/ea15e7e18254c45d?hl=en

I believe the solution provided above by Rob S. is equivalent.

Thanks! I’m starting to get the hang of how the nginx.conf file works
now.

  • Stefan S.