index.php, system_folder variable and multisite installation on windows |
[eluser]Unknown[/eluser]
I use Windows in my home and works station (producer server will use linux ). My CodeIgniter instalation is: “C:\www-root\codeigniter\” that contain the kernel of CodeIgniter. “C:\www-root\www.example.com\” that contain the index.php file and the content of application folder. See demo.javierav.com/CI001.jpg for image of folders. In index.php I have: $system_folder = “c:\www-root\codeigniter”; $application_folder = “c:\www-root\www.example.com”; If I access to http://localhost/www.example.com url I will obtain the following php error: “Fatal error: require_once() [function.require]: Failed opening required ‘C:\www-root\www.example.com/c:\www-root\codeigniter/codeigniter/CodeIgniter.php’ (include_path=’.;C:\Archivos de programa\xampp\php\pear\’) in C:\www-root\www.example.com\index.php on line 133” Where is the problem? In index.php on line 65 we have this: “if (strpos($system_folder, ‘/’) === FALSE)” and would have to have “if (strpos($system_folder, ‘/’) === FALSE AND strpos($system_folder, ‘\\’) === FALSE)” With this modification, my installation works fine. Is this a bug? Regards, Javier Aranda P.D Sorry for my bad english. I'm spanish.
[eluser]Seppo[/eluser]
Why don´t you use /, instead of \ ? It will also work on windows... Although I think CI should change the '/' for DIRECTORY_SEPARATOR to avoid this issues
[eluser]Michael Wales[/eluser]
You should use relative paths for the system_folder and application_folder variables. I pretty much do exactly the same as you: D:\xampp\htdocs\system D:\xampp\htdocs\[folder-for-site]\[contents of application folder] D:\xampp\htdocs\[folder-for-site]\index.php In index.php: Code: $system_folder = '../system';
[eluser]tonanbarbarian[/eluser]
I have found that I can use absolute paths and it works fine Interesting thing was when I first downloaded CI 6 months ago I had to use relative paths. Not sure but I think there have been some subtle changes to the index.php file that have been modified in the CI 1.5.4 version since its original release. I may not be right but it seems that way make sure that you have the following Code: /* With that in the index.php I find I can use absolute paths I also always use windows paths with / rather than \\
[eluser]John_Betong[/eluser]
Quote:In index.php I have: Try solving the first Fatal error: by changing this line: $system_folder = “codeigniter”; This will make a valid include path: ‘C:\www-root\www.example.com/codeigniter/CodeIgniter.php’
[eluser]Unknown[/eluser]
Hello. Quote:Why don´t you use /, instead of \ ? It will also work on windows…Thanks, I did not know that I can use "/" for windows path. :-) Michael, thanks. I don't like use relative path. Really, with my mod on index.php my installation works fine. Now, I will change the directory separator to "/". tonanbarbarian, I have downloaded Codeigniter yesterday from download page of this site. I think that these are the lastest version of CI, no? Many thanks to all. ;-) Regards, Javier Aranda
[eluser]xadio[/eluser]
Bug in Line 65 of index.php. Affects WINDOWS box users who supply full path using '\\' instead of '/'. Bug: Code: if (strpos($system_folder, '/') === FALSE) Fix: Code: if (strpos($system_folder, DIRECTORY_SEPARATOR) === FALSE) However, I don't think the function is necessary or the condition should be redefined because all it is searching for is a slash. Consider the following examples. Code: $system_folder = 'system'; # OK This function also implies that the index.php is somewhere in the path of the codeigniter system directory. Now for a normal install I don't think this makes a difference, but if another like I wish to place my CodeIgniter system directory in a completely different location than the index.php then it will matter. It would be nice if it were mentioned that "the index.php needs to be in the CI system path unless a full path is specified" in http://ellislab.com/codeigniter/user-gui...index.html .
[eluser]Derek Jones[/eluser]
xadio, I merged your report with this existing thread from a few days ago. Please see the comments above.
[eluser]xadio[/eluser]
Quote:xadio, I merged your report with this existing thread from a few days ago. Please see the comments above. Thanks Derek, I didn't take a lot of effort to search if this existed so my apologies to the forum members. Although slight as it is, I should probably use '/' instead of '\\' because it is replaced either way. However, the str_replace function exists so I would assume this was an intended possibility. If not then it should be reflected in the code and the User Guide. I still stand by my point that this is a bug. The definition of the conditional does not work for what appear to be intended. Code: if(TRUE){} // This is just to correct the php highlight problem I should wait to post this later as I am on a *nix box right now and cannot test the following on a win machine, but I won't wait. Please take it with/as a grain of salt. Code: if(TRUE){} // This is just to correct the php highlight problem Benchmarks (seconds): Code: Test: /tmp/absolute_exists The benchmarks above are the worst case scenario I could come up with after running it numerous times. So there is slight decrease in time for working cases while an increase in functionality, ignoring failed cases as it doesn't impact the speed of the overall system. Please note that I have not tested this in Windows, but I will try and report back later. If you want the php with benchmarks to test yourself just let me know. Please critique if you see an error in my logic/code.
[eluser]xadio[/eluser]
Just tested in windows and works flawlessly. However two small changes for consistency in error messages. Change: Code: if (($dirpath = realpath(dirname(__FILE__)) . '/') !== FALSE && ($realpath = realpath($dirpath . '/' . $system_folder)) !== FALSE) { To: Code: if (($dirpath = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR) !== FALSE && ($realpath = realpath($dirpath . DIRECTORY_SEPARATOR . $system_folder)) !== FALSE) { Side note: I like to define the DIRECTORY_SEPARATOR as DS. Like such: Code: define(DS, DIRECTORY_SEPARATOR); If you do this, just replace all the instances of DIRECTORY_SEPARATOR to DS. (Save line space ) |
Welcome Guest, Not a member yet? Register Sign In |