Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multiple distributions, different databases, without virtual servers
  • I've been trying to wrap my head around a request. I have an app and the client now wants to separate the data into two regional "portals". The app would be identical in all respects except for the database. I'm trying to avoid using virtual hosts and maintaining separate app folders.

    I've thought of a few different options like a drop-down in the login to select the portal. Then set the database based on the selection. Doable but more work.

    My next thought is to create two subdirectories. In each is an htaccess file that sets an environment variable and an index.php that changes directory back to document root and loads index.php. Seems doable but I'm not much of an htaccess guru.

    Any pointers or suggestions would be greatly appreciated. Just trying to fulfill the request with the least amount of work and resources.
  • HarroHarro
    Accepted Answer
    You can also do it in your app bootstrap.

    Currently that sets the environment based on the environment variable, and if not present to "development". But you can use any logic there to determine a custom environment. It all depends on what defines a "region".
  • Thanks Harro. I don't know why I always try to do things the hard way. I'll use two subdirectories with environment variables, adjust htaccess, set the databases in config, and copy index.php to each subdirectory adjusting paths to point to app and core. Then, in the root, I'll have an index.php that says no direct access. Assets should work as is (I hope). Done.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion