[eluser]DougW[/eluser]
I did this with symlinks for all system directories except for Applications. But then I switched to Mosso cloud computing. Now I have the same problem. I want to deploy several sites but with one main codeigniter set of code, except for the Applications folder.
I adjusted the system_folder and application_folder in /index.php. What I get is the firefox message:
"Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
Both have been triple-checked to be accurate.
Ideas anyone?
[eluser]DougW[/eluser]
Except that everything worked before changing the system_folder and application_folder. When I have these two on totally different paths, is there anythign else I need to change? Such as base_url?
[eluser]Jelmer[/eluser]
The base URL might be the problem, especially if you're running an application in different instances from different locations. The base URL should be different for each instance and if it's wrong that might cause problems. Though such problems still aren't caused by CI itself, the redirect loop would be somewhere in your implementation.
The point is that your server doesn't care where the code is located, as long as it can find the code - though the basepath for relative file operations from within your code would be relative to the location of your index.php. Such an error isn't caused by loading your code from a different location. It's caused by a continues redirect which is most likely caused by your .htaccess or your application. In your case I'd try disabling my .htaccess first and accessing the index.php file directly. Which would break the continues redirect if it's caused by the htaccess, or you could see where your code redirects to because that might not work anymore after the htaccess is disabled. If that still redirects like crazy, start checking your code for the location of a redirect that could trigger itself over and over again.
[eluser]DougW[/eluser]
Thanks. I'll give it a shot.
My directories are:
system_folder: /Users/fred/Sites/codeigniter/system
application_folder: /Users/fred/Sites/mysite/system/application
does the application folder HAVE to be in the sub-tree of CI?
I usually set by base_url to $_SERVER['HTTP_HOST'] so I don't have to worry about moving the site around.
When I had system folder set to system (under the docroot) everything worked fine. I am just truing to get both moved outside of docroot and be able to share the main CI directory amongst multiple sites..
[eluser]DougW[/eluser]
Actually, you were right. I have a goofy loop in my user class due to the fact that the Mosso cloud does NOT auto-start sessions in php. I got the system_folder and application_folder working with both relative paths and absolute paths.
Along this line, As the owner of this thread asked (I believe) I have several sites where I want to share system folder and MOST of the code in the application folder. I just want separate database connections. What I did was make a separate file with the database connection variables as defines, store one of these with each site, then modify database.php to include that file. Works like a charm if you are doing what I am which is offering white-label versions of your application, each with it's own database. With your solution above, I would soon run out of database definitions.
Thanks for your help!
ERdit.
I was wrong. Includes don't work. Your method above does. Thanks!
[eluser]DougW[/eluser]
I found an easier method. It only requires one change to database.php and then a custom index.php for each slave copy of your application.
In index.php, define four variables (more if you want to change more)
define('DATABASE_HOST', 'localhost');
define('DATABASE_USER', 'yourname');
define('DATABASE_PASS', 'yourpass');
define('DATABASE_NAME', 'database');
Then, leave your default database alone, just sent the array variables to the define variables as above...
$db['default']['hostname'] = DATABASE_HOST;
$db['default']['username'] = DATABASE_USER;
$db['default']['password'] = DATABASE_PASS;
$db['default']['database'] = DATABASE_NAME;
All I have to do to spawn an instance of my application is ensure that the system_folder and application_folder variables point to the right places and set the database variables in index.php.
Even config.php is handled by setting base_url as follows:
$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
Basically, you can have multiple copies of your application by only changing the index.php file.
Hope this helps!
Doug