CodeIgniter Forums
Multiple websites running from once application core - 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: Multiple websites running from once application core (/thread-59598.html)



Multiple websites running from once application core - El Forum - 10-25-2013

[eluser]lordmilutin[/eluser]
I need to create PHP application that will have same core for multiple clients.
Every client has his own folder ( subdomain ) where is his index.php file. Next to the index.php file in same folder is user specified config file for that client.
Every client has his own database.
Here is picture of how I imagine it.

[Image: shx8.png]

As you can see, CodeIgniter files are not in root directory. They are inside application/engine.

I have one class named Engine.php inside application folder. I want to make it simple to run from that file.

My clients will run their applications from their own folders
clients/city/user_1/index.php should look like this.

Quote:<?php
include "../../../Engine.php";
$app = new Engine();
$app->start();
?>

and have some more user specified configs ( like database name and user/pass ).

I have tried this, but when I do it like this, I have to change path to the system and application folder in CI index.php. After that I get errors from files in core libraries.

Is this even possible and how to "pack" ( wrap ) my CI application in other class that I can call in different folders and run application from there?

There are maybe answers on google, but I have no idea what even to search for this help.

I have seen user guide, but there only core is shared, and every application has own files.
In my case, every user has just different database, and maybe 2-3 files. Everything else is complete same. Atm I have 10 copies of same files on server, and every update I have to copy on 10 spots.



Multiple websites running from once application core - El Forum - 10-26-2013

[eluser]jmadsen[/eluser]
Haven't actually tried this, but you should only need to change two lines in your index.php files:

$system_path = '../system';

and

$application_folder = '../application';

So, you set these back to where your core files are. If you look at these and read the notes with them, should be able to work through it.


Multiple websites running from once application core - El Forum - 10-27-2013

[eluser]lordmilutin[/eluser]
Tried this. After that, I get many errors in library files in core folder.


Multiple websites running from once application core - El Forum - 10-27-2013

[eluser]CroNiX[/eluser]
Try using a full path


Multiple websites running from once application core - El Forum - 10-27-2013

[eluser]lordmilutin[/eluser]
I think I have explained it more detailed here:
http://stackoverflow.com/questions/19625865/running-multiple-clients-from-same-codeigniter-files


Multiple websites running from once application core - El Forum - 10-27-2013

[eluser]lordmilutin[/eluser]
[quote author="CroNiX" date="1382921121"]Try using a full path[/quote]

I do not get errors for including files, I get erros like

Code:
Fatal error: Call to a member function item() on a non-object in C:\wamp\www\projectX\application\engine\system\core\Utf8.php on line 47

and

Fatal error: Call to a member function elapsed_time() on a non-object in C:\wamp\www\projectX\application\engine\system\core\Output.php on line 360