CI Error: “Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php”

Quetions:

But I’m still getting the Error

“Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php”

Any ideas?

Answer:

In index.php when setting the $system_folder variable I noticed a slight problem. The realpath would not be determined if a relative address was given for the system folder. When entering ‘../system’ (a relative address) into the $system_folder variable caused the system to assume it was an absolute address.

Here is the code in question from index.php

<?php if (strpos($system_folder, '/') === FALSE)
{
if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
{
$system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
}
}
else
{
// Swap directory separators to Unix style for consistency
$system_folder = str_replace("\\", "/", $system_folder);
} ?>

it determines that through

<?php if (strpos($system_folder, '/') === FALSE) ?>

I suggest changing this to

<?php if (strpos($system_folder, '/') !== 0) ?>

This change makes the system only assume an absolute address if the first character is a forward slash. Eg. /apps/system = absolute, ../system = relative. Which is more correct in my opinion. Not many folks would have a problem with this but it caught me out today.



Leave a Reply

You must be logged in to post a comment.