Multiple coding environments

I am trying to understand the best way of doing things using several environments, such as development, testing, production for my application using codeigniter.

Now I have one folder for my application. I can see the places that are mentioned in the configuration file, making a folder for each of the environments and placing, for example, a copy of the database file in each of the folders in the environment.

Is this the best way to handle multiple environments? The reason I ask is because if I work on my dev subdomain, I still have to re-upload all the same files to the main root folder. Is this the best workflow?

So basically I have two sites.

dev.siteurl.com siteurl.com

I am trying to find a better way to handle this. Because I am wondering if I just need to upload all the files to the main level again so that it can process the production server or is there an easier way.

+5
source share
3 answers

Yes, how it works, in the / application / config folder you create an additional subfolder named development, so you have

/ app / Config / development /

Inside development, you put a copy of your database.php file and change your development database settings

/application/config/development/database.php

THEN you need to tell codeigniter which version you are in, so change index.php in the main root folder:

/index.php

define('ENVIRONMENT', 'development');

/config/development/database.php, , ,

edit: CI TOC , : http://ellislab.com/codeigniter/user-guide/general/environments.html

+7

envirement index.php
-

if ($_SERVER['SERVER_NAME']=='siteurl.com')
   define('ENVIRONMENT', 'production');
else if ($_SERVER['SERVER_NAME']=='test.siteurl.com')
   define('ENVIRONMENT', 'testing');
else
   define('ENVIRONMENT', 'development');

ENVIRONMENT

+6

, , Codeigniter URL-. , - , , .

siteurl.com siteurl.com/sandbox.

siteurl.com/index.php

define('ENVIRONMENT', 'production');
$system_path = '../system';
$application_folder = '../application';

siteurl.com/sandbox/index.php

define('ENVIRONMENT', 'development');
$system_path = '../../system';
$application_folder = '../../application';
+2
source

All Articles