CodeIgniter Forums
site doesn't load with include path - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: site doesn't load with include path (/thread-52947.html)



site doesn't load with include path - El Forum - 07-03-2012

[eluser]slapyo[/eluser]
I have a lot of sites that use the same /application/models/, /application/helpers/, and /application/libraries/.

I have them all sitting in /opt/www/includes/application/ and I also have /opt/www/includes/system/.

In PHP I have the include path set so that all I have to do is include('system/...') and it will work. But it's not.

In the individual sites root folders they do not have the 3 folders in application and they don't have the system folder. If I add them in, the site works no problem. However, for the sake of having to edit the same file over and over I'd really like to have one central place for them all to be. Should I make symbolic links?

Ideas, suggestions ... anything?


site doesn't load with include path - El Forum - 07-03-2012

[eluser]Aken[/eluser]
Use Application Packages. http://ellislab.com/codeigniter/user-guide/libraries/loader.html


site doesn't load with include path - El Forum - 07-03-2012

[eluser]slapyo[/eluser]
[quote author="Aken" date="1341352663"]Use Application Packages. http://ellislab.com/codeigniter/user-guide/libraries/loader.html[/quote]
Does this work across multiple servers? Can you explain a little more how you set it up?


site doesn't load with include path - El Forum - 07-03-2012

[eluser]Aken[/eluser]
An application package is a folder with various CI-like subfolders (models, helpers, libraries, etc). Adding the application path tells CI to look for files in these folders as well as in your /application/... and /system/... folders. Read the user guide page for more information, that's why I linked it.

I'm under the assumption that you have multiple CI applications on the same server, all with access to the common /includes/ folder. If you are trying to use one shared folder between multiple servers, that is inadvisable for a bunch of reasons.


site doesn't load with include path - El Forum - 07-03-2012

[eluser]slapyo[/eluser]
[quote author="Aken" date="1341353765"]An application package is a folder with various CI-like subfolders (models, helpers, libraries, etc). Adding the application path tells CI to look for files in these folders as well as in your /application/... and /system/... folders. Read the user guide page for more information, that's why I linked it.

I'm under the assumption that you have multiple CI applications on the same server, all with access to the common /includes/ folder. If you are trying to use one shared folder between multiple servers, that is inadvisable for a bunch of reasons.[/quote]
Ok cool, I'm gonna check it out now. I was out of the office for a little and on my phone.

I'm not sharing a folder across multiple servers, I have SVN push that folder to all the servers.


site doesn't load with include path - El Forum - 07-03-2012

[eluser]Aken[/eluser]
Okay, then you just need to make sure to add the application path support to each of your applications. That should be the only change you need to make to every website.


site doesn't load with include path - El Forum - 07-03-2012

[eluser]slapyo[/eluser]
[quote author="Aken" date="1341355357"]Okay, then you just need to make sure to add the application path support to each of your applications. That should be the only change you need to make to every website.[/quote]

Ok that all seems to be working except that I need to extend the cache drivers to have a memcache driver I wrote. I thought maybe putting the Cache folder in the libraries would work but it doesn't seem to.


site doesn't load with include path - El Forum - 07-03-2012

[eluser]Aken[/eluser]
Correct. The Cache driver needs to be extended if you wish to implement your own driver. I think you should only need to add your driver's name to the $valid_drivers array. Then you can add the driver itself to your common folder, IE: /includes/libraries/Cache/drivers/Cache_yourdriver.php