Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Noob Question: 'No input file specified' message
  • I've installed Fuel, and it's nominally running. I see the "You have successfully installed the Fuel PHP Framework" message when I visit the domain root (e.g. http://mysite.example.com/ or http://mysite.example.com/index.php). When I type in any other path without index.php (e.g. http://mysite.example.com/should-be-a-404/), I get the "No input file specified" message, rather than a 404. When I type in a path with index.php (e.g. http://dev1.app.webformglue.com/index.php/should-be-a-404/), I get the fuel 404 (Bloody Hell!). Here's my .htaccess - I believe it's the default provided with RC2:
    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
    
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule mod_rewrite.c>
    

    Environment: CentOS 5 at WebFaction using a custom Apache stack with PHP 5.3 (fastcgi). Help a noob out :)
  • Thank you all.. it make my day..! :D
  • I've pushed an updated .htaccess to 1.4/develop that will support both mod_php5 and fastcgi out of the box. Hopefully that will avoid questions like this in the future.
  • I have the same troubles! I changed that line in htaccess as Kurt suggested and now I have my 404 whenever I try to access any other controller than Index. I don't know, on my Windows platform all worked (I have some extra configuration in routes.php), but now it doesn't work. I can't access, for example, sign-in and signIn too! Here're my routes:
    return array(
    
     '_root_' => 'index',
     '_404_' => '404',
    
     'sign-in' => 'signIn',
     'sign-in/(:segment)' => 'signIn/$1',
     'sign-out' => 'signOut',
     'sign-up' => 'signUp',
     'sign-up/(:segment)' => 'signUp/$1',
    
    );
    

    It's UNIX (Linux Ubuntu, I guess) again...
  • Strange that Query String Append fixed your issue as I it shouldn't be needed due to the $1 which should tag on any query strings etc... I simply added the ? and all was good in my world. But if it works for you :-) Made a mental note of this should I come across it in future.
  • The question mark is indeed required when using fastcgi. It should NOT be there for normal Apache setups.
  • Yes, I have FastCGI. I changed .htaccess as suggested - "No input file specified" disappeared, but now I have my custom 404 pages for pages that exist as well (except: index page)! You can have a look here... http://non.dagrevis.lv/wravem/
    http://non.dagrevis.lv/wravem/sign-in
    http://non.dagrevis.lv/wravem/sign-up After var_dump( $_REQUEST ); execution on index.php... FastCGI:
    array(1) { ["/a/a"]=> string(0) "" }
    

    Apache (I believe it is (XAMPP on Windows)):
    array(0) { }
    
  • I seem to have worked this out. I tried a few .htaccess configurations before I posted my original query here, but none of them did the trick. A little more googling brought me to this codeigniter forum post: http://codeigniter.com/forums/viewthread/55620/ Based on the advice in that thread, I'm now using the following .htaccess file and am at least getting 404's where I'd expect to:
    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
    
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule mod_rewrite.c>
    

    See the question mark added in the RewriteRule line - that's the only difference to the original .htaccess file. I'll report back if I have any other trouble with routing. Otherwise, consider no news to be good news. :)
  • Anyone? I can provide more info, if needed.
  • Harro Verton wrote on Friday 20th of May 2011:
    The question mark is indeed required when using fastcgi. It should NOT be there for normal Apache setups.

    I am experiencing similar issues as others in this thread. For me the combination of fastCGI + Rest + [url= the .htaccess question mark workaround causes Input::get('foo') to simply not work in my Rest controller. Say I follow the example in the docs for a simple Rest controller like:
    class Controller_Test extends Controller_Rest &#123;
    
        public function get_list()
       &#123;
            $this->response(array(
                'foo' => Input::get('foo'),
                'baz' => array(
                    1, 50, 219
                ),
                'empty' => null
            ));
        }
    }
    
    I call mylocalhost/test/list.json?foo=bar and it appears to work! It looks like JSON, and the 'baz' array has some values. Oh, but wait, what's up with foo? It's null! I expected it to say that foo's value is equal to "bar". I'm not sure where in the sausage factory that the GET params are chopped up and stored for Input to use, but it appears that part of the factory needs some work? The CI docs indicate that horking GET is done for our own good, but I wonder if there's a way to preserve security while allowing for fastCGI and Rest? Given how many people have failed at solving this issue, I am not optimistic that there is a .htaccess silver bullet that will make this work. The only workaround I have been able to dig up is here at Stack Overflow. Basically, do a print_r on the $_SERVER and find out where those url parameters are hiding, then do something with them. EDIT: url formatting
  • Evan Tishuk wrote on Wednesday 6th of July 2011:
    The only workaround I have been able to dig up is here at Stack Overflow. Basically, do a print_r on the $_SERVER and find out where those url parameters are hiding, then do something with them.

    I forgot to mention that the aforementioned workaround does indeed do the trick. Here's what it would look like if placed in the Rest Controller code example from before:
    public function get_list()
    {
    
        [b]parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);[/b]  // blehck
       
        $this->response(array(
                'foo' => Input::get('foo'),
                'baz' => array(
                    1, 50, 219
                ),
                'empty' => null
        ));
    }
    
  • Evan Tishuk wrote on Wednesday 6th of July 2011:
    Given how many people have failed at solving this issue, I am not optimistic that there is a .htaccess silver bullet that will make this work.
    . I stand corrected. There is a silver bullet. If, after adding the all-important "?" to .htaccess, you are still experiencing problems... here's the solution. Change the [L] flag (Last) to a [QSA] flag (Query String Append). Example:
    RewriteRule ^(.*)$ /index.php?$1 [L]
    

    to
    RewriteRule ^(.*)$ /index.php?$1 [[b]QSA[/b]]
    

    Viola! No need for recapturing the query params from other server variables -- phew. Also, I found this post rather instructive on the security settings we have available. Would be good to link to this somewhere in the docs. Thanks for joining me on this evening's journey into mod_rewrite and fastCGI.
  • Poor me... none can help me. As far I found this topic about similar problem for CodeIgniter, but it didn't helped me.
  • I think Phil and Dan have some fastcgi experience, maybe they can be of some help. I've never used it.
  • Then try to encourage them to help me. It seems that they ignore me... or simple don't know. =D P.S. It's annoying that "read-topics" function, I guess, works on cookies. You see... I'm now viewing this forums using another PC, but the same account... and I see this topic as "unread" even if I read it with other PC before two hours!
  • I agree with you that the forum function of PyroCMS are very basic. But that's what's been chosen. I know Phil is travelling at the moment, not sure if he has a lot of time while on the road. I'm sure Dan reads the forums, so if he has something to add, I'm sure he will...
  • Well, using jQuery and FastCGI (with the index.php? fix) I can't access GET method with the Rest Controller...

    Any suggestions?
  • Are you using the supplied .htaccess file? Or your own rewrite rules?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion