CodeIgniter Forums
Library path problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Library path problem (/showthread.php?tid=43546)



Library path problem - El Forum - 07-15-2011

[eluser]Wayne Smallman[/eluser]
Hi guys!

I've successfully loaded a library that's within the application/library folder, but this fails to load on the live website:
Code:
$uri_segment['client_id'] = $this->uri->segment(3);

        if (isset($uri_segment['client_id'])
            && ($uri_segment['client_id'] > 0)):

            if (file_exists(APPPATH . 'libraries/customers/' . $uri_segment['client_id'] . '/processing.php')):

                $this->load->library('customers/' . $uri_segment['client_id'] . '/processing');

            endif;

        endif;
The APPPATH constant is identical in each instance.

Specifically, it's the file_exists() function that's failing, and when I try visiting the file or file path, rather than get the obligatory 403 error, I'm getting a 404.

Any ideas what's happening?


Library path problem - El Forum - 07-15-2011

[eluser]LuckyFella73[/eluser]
The CI user guide says library filnames must be capitalized.
Try to name the file "Processing.php".

Maybe your develop server is a windows server and is not taking
care about case sesitive things?


Library path problem - El Forum - 07-15-2011

[eluser]John_Betong_002[/eluser]
The php function requires a complete path and APPPATH is not a complete path.

http://th.php.net/manual/en/function.file-exists.php

Try this:
Code:
if( file_exists( $_SERVER{'DOCUMENT_ROOT'} .....
 


Library path problem - El Forum - 07-15-2011

[eluser]Wayne Smallman[/eluser]
[quote author="LuckyFella73" date="1310760520"]The CI user guide says library filnames must be capitalized.
Try to name the file "Processing.php".

Maybe your develop server is a windows server and is not taking
care about case sesitive things?[/quote]Hi and thanks for the reply.

I'm using Linux, but the name was part of the problem.


Library path problem - El Forum - 07-15-2011

[eluser]Wayne Smallman[/eluser]
[quote author="John_Betong_002" date="1310761307"]The php function requires a complete path and APPPATH is not a complete path.

http://th.php.net/manual/en/function.file-exists.php

Try this:
Code:
if( file_exists( $_SERVER{'DOCUMENT_ROOT'} .....
 [/quote]Hi and thanks for the reply.

The problem was the lack of lead case.