1and1, php5 and CodeIgniter

#11
[eluser]jeephnx[/eluser]
Hi I also had problems with a proven CI 1.7.2 app when I added the php5 instruction to 1&1 .htaccess file. The initial problem I had involved a page that ran Google site search. This broke as it has GET info on the URL, and resulted in illegal chars in the URL. Setting $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\&\='; in config.php fixed this problem, but resulted in a 404 page not found error.

It seems 1&1's php5 $_SERVER vars do not store urls same way as php4. Because the order the vars are tested in /system/libraries/url.php when $config['uri_protocol'] = 'AUTO' and the way the $_SERVER vars were populated made it work differently between php4 and php5. It became apparent I could fix the google problem by forcing the $config['uri_protocol']= "ORIG_PATH_INFO";

This worked fine for all my pages except the home page when the URL segments were empty!

This was because the IF's employed in /system/libraries/url.php for checking the URL in the AUTO block were not used if $config['uri_protocol'] is set to anything except AUTO.

So I created a copy of /system/libraries/url.php and changed the following snipit around line 107 FROM


Code:
if ($uri == 'REQUEST_URI')
    {
         $this->uri_string = $this->_parse_request_uri();
         return;
    }

    $this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);

TO


Code:
if ($uri == 'REQUEST_URI')
    {
        $this->uri_string = $this->_parse_request_uri();
        return;
    }

    #$this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
        
    $path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
    if (trim($path, '/') != '' && $path != "/".SELF)
    {
        // remove path and script information so we have good URI data
        $this->uri_string = $path;
    }


and saved it all to my applications/libraries folder.

It worked for me. Maybe it will be of use...


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.