CodeIgniter Forums
Code Igniter setup in production - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html)
+--- Thread: Code Igniter setup in production (/thread-63172.html)



Code Igniter setup in production - estebanc - 10-02-2015

Hello there,

is there any documentation on how to set up CI in a production environment?. What I am looking for is a best practices document specifying the implications of setting CI in production. For example, the logs directory I guess it should not be in the server root of the apache web server due to the permissions it requires......I am sure there must be a lot of other considerations..


Thanks!


RE: Code Igniter setup in production - Muzikant - 10-02-2015

It should be enough, if you will make changes in main index.php file:

PHP Code:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); // this is important
...
$system_path '../system'// you can move your system directory on more secure location if you can (on some web hostings you can not do that)
...
$application_folder '../application'// as well as application directory (values are just an examples, your relative paths may vary) 



RE: Code Igniter setup in production - cartalot - 10-02-2015

* rename your application and system folders and put them a level above the public index.php file. you can do any naming that makes sense but its nice to have the version number in the system folder name so its immediately obvious which CI system it is. and its nice to have a date on your application folder. 

so in your index page you will have something like 
$application_folder = '../jellybellyapp_sept152015_beta';
$system_folder = '../system301';

so lets say CI comes out with system 3.05 and you want to upgrade. name the folder system305, upload it, change your index file link and preview. this way if there is some issue or bug - system301 is right there and ready and you can immediately switch back. same idea with your application folder, you can upload different versions of your application and instantly switch between them just by changing the link on the index page. that way if you move to a newer version of your app, and discover some horrible bug, you can revert just by changing the link. much. less. stressful. 

* do not specify your base_url in the application/config.php file. put your base_url config on your index page. this will save you SO much time if you have separate development and live versions.
$assign_to_config['base_url'] = 'https://jellybellyforever.com';

versus say the index page on your development version if working locally etc 
$assign_to_config['base_url'] = 'http://localhost';

* have a folder called assets or similar that holds external files on the "public" level. that is for your css files, js, etc. 


RE: Code Igniter setup in production - kankuro - 10-02-2015

You check this out hope it helps a lot http://codeigniter.tv/ and if you prefer video tuts you can find this one in torrent http://code.tutsplus.com/courses/codeigniter-best-practices and also in youtube. There is a topic there on how to set-up CI from develepment, staging and production server.


RE: Code Igniter setup in production - estebanc - 10-14-2015

(10-02-2015, 10:40 AM)Muzikant Wrote: It should be enough, if you will make changes in main index.php file:


PHP Code:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); // this is important
...
$system_path '../system'// you can move your system directory on more secure location if you can (on some web hostings you can not do that)
...
$application_folder '../application'// as well as application directory (values are just an examples, your relative paths may vary) 

Thank you!


RE: Code Igniter setup in production - estebanc - 10-14-2015

(10-02-2015, 06:37 PM)kankuro Wrote: You check this out hope it helps a lot http://codeigniter.tv/ and if you prefer video tuts you can find this one in torrent http://code.tutsplus.com/courses/codeigniter-best-practices and also in youtube. There is a topic there on how to set-up CI from develepment, staging and production server.

Thanks, the video is simple and clear!.