phpcodeigniterresourcessymlinkcode-sharing

Codeigniter Shared Resources - Opinions Wanted


I run multiple websites all running off of a single installation of CodeIgniter on my server (separate application directories and a single system directory). This has been working fabulously and I don't see any reason to change it at this point.

I find myself writing library classes to extend/override CI all of the time and many times if I find a bug or improve effeciency I have to go back to several websites to make the same adjustments at risk of a typo that breaks one of the websites. Because of this it requires that I change each file and then test that site for bugs.

I have been pondering a solution of using a single libraries directory in a central location and symlinking all of my websites to that central directory. Then when I make a file change it will immediately propagate to all of the downstream websites. It will still require that I test each one for errors, but I won't have to make the changes multiple times. Anything that is specific to a single website will either be a non-shared file (still in the linked directory just not used elsewhere) or can be put in a local helper.

Also, I keep separate 'system' directories by CI version so I can migrate my websites independently if necessary--this central libraries file would be attached to a specific version to reduce possible breaks.

Does anyone see potential issues or pitfalls from taking this approach? Has anyone accomplished this in another direction that I should consider?

Thanks in advance!


Solution

  • I think this actually makes sense :] Go for it. Even on official CodeIgniter page, they mention it's possible.

    Also, I don't see one reason why there should be any problem.

    Edit: they touch the problem of multiple sites here: http://codeigniter.com/user_guide/general/managing_apps.html

    also:

    http://codeigniter.com/wiki/Multiple_Applications/
    http://www.exclusivetutorials.com/setting-multiple-websites-in-codeigniter-installation/
    How to Handle Multiple Projects in CodeIgniter?
    http://codeigniter.com/forums/viewthread/56436/