Search code examples
phpapache.htaccessfastcgi

Getting "No input file specified." only when PATH_INFO is empty?


I've installed GitList in a subdomain (PHP FastCGI 5.4.29). The following .htaccess comes with the default installation:

<IfModule mod_rewrite.c>
    Options -MultiViews +SymLinksIfOwnerMatch

    RewriteEngine On
    #RewriteBase /path/to/gitlist/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [L,NC]
</IfModule>
<Files config.ini>
    order allow,deny
    deny from all
</Files>

When I try to access http:/subdomain.company.com i get the following error:

No input file specified.

I guess the error comes when PATH_INFO is empty, but I don't know how to fix it. If I access http:/subdomain.company.com/index.php the application works just fine.

And this is the directory structure, if can help:

-rw-r--r--  1 iosystit psacln   435 Jun 30 05:07 boot.php
drwxrwxrwx  3 iosystit psacln  4096 Jul 20 04:09 cache
-rw-r--r--  1 iosystit psacln   831 Jul 20 11:14 config.ini
-rw-r--r--  1 iosystit psacln   975 Jun 30 05:07 config.ini-example
-rw-r--r--  1 iosystit psacln   291 Jun 30 05:07 .htaccess
-rw-r--r--  1 iosystit psacln   690 Jun 30 05:07 index.php
-rw-r--r--  1 iosystit psacln  2505 Jun 30 05:07 INSTALL.md
-rw-r--r--  1 iosystit psacln  1477 Jun 30 05:07 LICENSE.txt
-rw-r--r--  1 iosystit psacln  5358 Jun 30 05:07 README.md
drwxr-xr-x  3 iosystit psacln  4096 Jun 30 05:07 src
drwxr-xr-x  4 iosystit psacln  4096 Jun 30 05:07 themes
drwxr-xr-x 16 iosystit psacln  4096 Jul 20 04:05 vendor

EDIT: I accepted the answer because the link No input file specified pointed me to the solution, but I'm not using nginx:

RewriteRule ^(.*)$ index.php?/$1 [L,NC]

Solution

  • Probably you need to change some settings.

    For exmaple for nginx there is a tip to make a change:

    server {
        location = / {
            try_files @site @site;
        }
    
        location / {
            try_files $uri $uri/ @site;
        }
    
        location ~ \.php$ {
            return 404;
        }
    
        location @site {
            fastcgi_pass   unix:/var/run/php-fpm/www.sock;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME $document_root/index.php;
        }
    }
    

    More info at Github. Also similar problem (but for different libraray) is at No input file specified