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

Rob Schultz rschultz7 at gmail.com
Mon Dec 1 06:34:58 MSK 2008


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
On Nov 30, 2008, at 8:33 PM, Stefan Scott wrote:

> 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   ( к счастью учил  
> русский язык давно в
> колледже :-)
> http://www.darvilworld.com/?cat=5
>
> --------------------------------------------------------
>
> 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 Scott
> -- 
> Posted via http://www.ruby-forum.com/.
>






More information about the nginx mailing list