how to set up two codeigniter applications running on same server

杀马特。学长 韩版系。学妹 提交于 2019-12-13 19:33:12

问题


I build a codeigniter app a few months ago - it's a networking tool. Now my client wants me to build a reporting application for them - accesses the same database the networking tool does, but it's not really related.

I've downloaded a fresh / newer copy of codeigniter into a new folder under www ... but now I'm wondering this is the right way to architect the solution .. physically. Has anyone else tried building multiple ci applications on the same server? Should I be / Can I combine disparate apps so that they use the same copy of the ci code? I've read somewhere about HMVC. Does that apply here? I'm going to google now as well to read up on it, but if you can just point me in the right direction, that'd be great. Any comments would be appreciated.


回答1:


You can do either.

See http://ellislab.com/codeigniter/user-guide/general/managing_apps.html for details on using the same CI install to run multiple sites.

Alternatively, you could create another CI install in another folder and point your server software or users at it.




回答2:


suppose you have two application on same server using same session names and if you login it logins another application also to avoide this issue you just need to go to config.php file under application folder and provide the unique name to cookies session

    For Application a

    $config['sess_cookie_name']     = 'applicationa';
    $config['sess_expiration']      = 7200;
    $config['sess_expire_on_close'] = FALSE;
    $config['sess_encrypt_cookie']  = FALSE;
    $config['sess_use_database']    = TRUE;
    $config['sess_table_name']      = 'ci_sessions';
    $config['sess_match_ip']        = FALSE;
    $config['sess_match_useragent'] = TRUE;
    $config['sess_time_to_update']  = 300;


    For Application b
    $config['sess_cookie_name']     = 'applicationb';
    $config['sess_expiration']      = 7200;
    $config['sess_expire_on_close'] = FALSE;
    $config['sess_encrypt_cookie']  = FALSE;
    $config['sess_use_database']    = TRUE;
    $config['sess_table_name']      = 'ci_sessions';
    $config['sess_match_ip']        = FALSE;
    $config['sess_match_useragent'] = TRUE;
    $config['sess_time_to_update']  = 300;


来源:https://stackoverflow.com/questions/21291137/how-to-set-up-two-codeigniter-applications-running-on-same-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!