• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting Up Two CI On One Server

#1
I'm having a bit a trouble setting up two CI on one server.

Currently I want my application to do this:

www.example.com will run the main CI application
www.example.com/app2 will run the second CI application running on the server.

Currently I'm thinking that my directory structure can be this

/var/www/html/application1
/var/www/html/application1/app2

That way when I visit www.example.com/app2 it will automatically run the second CI application.

All is currently working well except for app2.
When I visit www.example.com/app2, it will visit the first homepage of the CI application but after I log in it will remove the subfolder URI
It will be like this www.example.com/login/tryLogin which will be a 404 Page Not Found since it needs to be www.example.com/app2/login/tryLogin

I added the base URL to be http://www.example.com/app2/ in the config file. But it keeps replacing app2. I'm thinking it might be my .htaccess to remove the index.php but I did a quick test to not have a htaccess but this issue is still the case.
Reply

#2
When you say second app, do you mean a completely separate install of codeigniter? 

If so, is it absolutely required that you use 2 folder with CI in it?

It seems like your solution might be a simple change to the routes file. It will also remove the need for 2 codeigniters for 1 application.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#3
It is not necessary for me to use 2 folders with CI in it.

I think all I want to accomplish is just www.example.com to use all the controller created for CI 1
and then www.example.com/app2 to use all the controller created for CI 2 as they are different website/applications.

How would I accomplish this using routes file?
Reply

#4
And yes when I say second app it does mean a complete separate install of codeigniter.

When I was looking at route it seems like I will need a controller named app2 so that when I call app2 it will route accordingly? Does that mean for all the controllers that I use for app2 will have to be added into the routes?

So if I go the routes file route. I will have to create a controller called app2 and then in order for app2/login/tryLogin in to work
the configuration would have to look something like this?

$route['app2'] = "app2/login"; <--this being app2 folder inside controller

I tried this way without a app2 controller and I seem to get a 404.
Reply

#5
NVM looks like the reason why it was getting overwritten was because of code.

I guess then my question to @albertleao is what is the proper way to do this?
Should I be doing the routes way? Or can I just have two CI?
Reply

#6
Hi,

Here is how I do this: Put CI folder above the document root, create 2 application folders.

/server/codeigniter/system (CI dore)
/server/codeigniter/app1 and /server/codeigniter/app2

Then you need an index file under the document root for each application
/server/document_root/index.php (index for app1)
/server/document_root/app2/index.php (index for app2)
You need to set the $application_folder in each index file.

There is a few variation to this setup that would work as well but this gives you a basic idea.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.