Part of the EllisLab Network
   
2 of 2
2
Dreamhost => [No input file specified]
Posted: 10 April 2008 10:44 AM   [ Ignore ]   [ # 16 ]  
Summer Student
Total Posts:  2
Joined  04-10-2008
DavidCassidy - 04 July 2007 10:13 PM

Actually, it was a tiny addition to the .htaccess file that finally solved it. So, for all you Dreamhost users out there, use this to strip that nasty index.php string from your URLs:

RewriteEngine On
RewriteCond 
$!^(index\.php)
RewriteRule ^(.+)$ index.php?$1 [L] 

It seems the question mark on teh third line is the key.


Just wanted to add for the record that this solution also works for ICDSoft host provider.

Profile
 
 
Posted: 25 May 2008 07:06 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  12
Joined  05-22-2008

I am just curious. Does this problem happened to other frameworks too ? such as Zend framework, Cake and so on. I am very very tired of getting every little things fixed in the host environment. I am feeling like making “The framework” on my own!!

Profile
 
 
Posted: 27 October 2008 09:03 PM   [ Ignore ]   [ # 18 ]  
Summer Student
Total Posts:  5
Joined  07-02-2008
llbbl - 09 December 2007 12:26 AM
RewriteRule ^(.*)$ index.php?/$1 [L] 

While the above works, and fixes the issue in most cases, I came across a problem where if I wanted to allow URL parameters (enabling query strings), the $_GET array was not being populated correctly because something like this:

http://mysite.com/controller/action/?var=val&var2=val2 

On Dreamhost (with PHP as CGI) using the RewriteRule above turns into:

http://mysite.com/index.php?/controller/action/?var=val&var2=val2 

Which causes CodeIgniter (due to the extra ’?’) to have the $_GET array not be populated as expected (with var,var2 as keys and val,val2 as values).

The solution I came up (for us with Dreamhost, running PHP 5.2+ as CGI) was to repopulate the $_GET array using the REQUEST_URI by creating an extension of of the CI_Input class. The solution is to create a MY_Input.php (as explained by a previous poster) under application/libraries:

<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class 
MY_Input extends CI_Input {

    
function __construct()//Or MY_Input()
        
        //get the URL query string from the REQUEST_URI
        
$get_string array_popexplode('?',$_SERVER['REQUEST_URI'],2) );
        
//parse the pairs of parameters
        
$pairs_array explode('&',$get_string);
        
/*
        adding these values to the GET array before sending it to the
        Core Input class.
        */
        
foreach($pairs_array as $pair){
            
list($key,$value) = explode('=',$pair);
            
$_GET[$key] $value;
        
}
        
//continue as normal    
        
parent::CI_Input();
        
        
}

You will still have to set the following in your config file (as explained previously in this thread):

$config['uri_protocol']    "AUTO";
$config['enable_query_strings'TRUE

I’m sure someone can write better code than I can. I just wanted to help other CI deployments, since I didn’t find a solution to this issue.

Profile
 
 
Posted: 26 June 2009 03:41 AM   [ Ignore ]   [ # 19 ]  
Summer Student
Avatar
Total Posts:  28
Joined  03-14-2007

I’ve got this error (No input file specified) in quite strange way - some website parts was working, some was not. This code helped me:

RewriteEngine on

    
# Must do this before a trailing slash gets put on it
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d

RewriteCond 
$!^(index\.php|images|img|css|js|blog|robots\.txt)
RewriteRule (.*) index.php?/$1 [L] 
Profile
 
 
Posted: 25 August 2009 05:40 PM   [ Ignore ]   [ # 20 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  109
Joined  08-12-2009
xtracto - 10 April 2008 02:44 PM
DavidCassidy - 04 July 2007 10:13 PM

Actually, it was a tiny addition to the .htaccess file that finally solved it. So, for all you Dreamhost users out there, use this to strip that nasty index.php string from your URLs:

RewriteEngine On
RewriteCond 
$!^(index\.php)
RewriteRule ^(.+)$ index.php?$1 [L] 

It seems the question mark on teh third line is the key.


Just wanted to add for the record that this solution also works for ICDSoft host provider.


Thanks for the good attitude.
It saved me hours of laborious time.

Regards,
Márcio

Profile
 
 
Posted: 09 September 2009 10:41 PM   [ Ignore ]   [ # 21 ]  
Summer Student
Total Posts:  7
Joined  06-16-2008

This thread has been a big help to me. Apersaud, while your solution does work, I didn’t see why we should have to settle for:

http://mysite.com/index.php?/controller/action/?var=val&var2=val2 

rather than the norm:

http://mysite.com/index.php?/controller/action?var=val&var2=val2. 

So after a bit of tinkering with my Dreamhost shared hosting setting, I finally came up with a solution that doesn’t require the Input extension. The way I got it to work was to change my hosting from the default PHP5 FastCGI to PHP5 CGI. I could then remove the ? from my htaccess file so it read:

RewriteEngine on
RewriteCond 
$!^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L] 

And finally changed my codeigniter config setting to:

$config['uri_protocol']    "PATH_INFO";
$config['enable_query_strings'TRUE

Now I can use the following URI, and get the value of var and var2 using the default input class.

http://mysite.com/index.php?/controller/action?var=val&var2=val2. 
$this->input->get('var'); 

I hope this can help for anyone else on Dreamhost who is pedantic like me and couldn’t accept that they needed an extra ‘/’ in their URI and an extension to the input class to perform a seemingly simple task.

Profile
 
 
Posted: 01 January 2010 04:29 PM   [ Ignore ]   [ # 22 ]  
Summer Student
Avatar
Total Posts:  6
Joined  07-06-2008

I believe the problem is likely due to your server environment not providing the PATH_INFO data, most likely when php is run as a CGI.

The correct solution is probably to add a handler type in your apache config, or in cases where you don’t have access to this, an .htaccess file:

<FilesMatch ".php">
   
SetHandler application/x-httpd-php
</FilesMatch
Profile
 
 
Posted: 23 March 2010 10:41 AM   [ Ignore ]   [ # 23 ]  
Summer Student
Total Posts:  4
Joined  03-08-2010
llbbl - 28 September 2007 04:37 AM

I think it makes the 2nd p optional, which still doesn’t make much sense why it works…

I had the same problem, using php5 with mod_security enabled. fastcgi disabled. and the ? works.

I feel like I mostly understand what is going on in the .htaccess, but not fully and not enough to explain it. :(


2nd p is not optional, I think it makes the rest of the url as a GET parameter.
The first parameter is regex match second is a string.

Profile
 
 
Posted: 23 April 2010 03:35 AM   [ Ignore ]   [ # 24 ]  
Summer Student
Total Posts:  6
Joined  04-15-2010

Hi guys,

If still there is any problem, have a look at this link, it will help you.
http://pankajdangi.com/2010/04/no-input-file-specified-codeigniter/

Thanks
Pankaj

Profile
 
 
Posted: 23 April 2010 10:09 AM   [ Ignore ]   [ # 25 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  04-04-2009
pranky - 23 April 2010 07:35 AM

Hi guys,

If still there is any problem, have a look at this link, it will help you.
http://pankajdangi.com/2010/04/no-input-file-specified-codeigniter/

Thanks
Pankaj

This has worked for everyone I’ve recommended it to (several).

 Signature 

Postmark Library
CloudIgniter—Legit CodeIgniter Hosting
Seriously Awesome MojoMotor Addons

Profile
 
 
Posted: 23 April 2010 12:38 PM   [ Ignore ]   [ # 26 ]  
Summer Student
Total Posts:  6
Joined  04-15-2010

Thanks Techneke

Profile
 
 
Posted: 24 April 2010 03:44 AM   [ Ignore ]   [ # 27 ]  
Summer Student
Total Posts:  4
Joined  04-24-2010

http://codeigniter.com/wiki/Dreamhost_.htaccess/

You can find the information in wiki page, above.

Profile
 
 
Posted: 05 August 2010 07:36 AM   [ Ignore ]   [ # 28 ]  
Summer Student
Total Posts:  1
Joined  08-05-2010

Any suggestions for getting CI to work on a server with CGI PHP, PATH_INFO available, mod_security OFF and mod_rewrite OFF?

Profile
 
 
Posted: 24 January 2012 02:12 AM   [ Ignore ]   [ # 29 ]  
Summer Student
Total Posts:  1
Joined  11-23-2011

Thank you so much. ? worked perfectly for me. Is there any particular reason why using the request_uri would be better than using the ? trick in the .htaccess file?

Profile
 
 
   
2 of 2
2