Share session between Core Php & CodeIgniter -


i have web app in core php. , moving ci framework step step.

problem: need share session value between them.

core php app dir structure:|-- /xampp/lms/
core php app url: http://localhost/lms/index.php

ci app dir structure: |-- /xampp/lms/newlms/
ci app url: http://localhost/lms/newlms/index.php/login

ci configuration:

config.php  $config['sess_driver'] = 'database'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = 'ci_sessions'; $config['sess_match_ip'] = false; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = false;  $config['cookie_prefix']    = ''; $config['cookie_domain']    = ''; $config['cookie_path']      = '/'; $config['cookie_secure']    = false; $config['cookie_httponly']  = false; 

what have did far.

core php changes
path: \xampp\htdocs\lms\configuration.inc.php (this file called first in core php)

session_name('ci_session'); session_start();  echo '<pre>'; echo '<br/>------------- session_save_path-------- <br/>'; print_r(session_save_path()); echo '<br/>------------- session_name-------- <br/>'; print_r(session_name()); echo '<br/>------------- $_cookie -------- <br/>'; print_r($_cookie); echo '<br/>------------- $_session -------- <br/>'; print_r($_session); exit;   

output:

------------- session_save_path--------  \xampp\tmp ------------- session_name--------  ci_session ------------- $_cookie --------  array (     [ci_session] => 2b9tj8rek53kapgsuh4k3v2fuuvblvq9 )  ------------- $_session --------  array (     values have set in core php )   

session path xampp\tmp\sess_2b9tj8rek53kapgsuh4k3v2fuuvblvq9

ci changes
path: \xampp\htdocs\lms\newlms\application\modules\login\controllers

class login extends mx_controller {     function __construct() {      parent::__construct();    }     function index() { echo '<pre>'; echo '<br/>------------- session_save_path-------- <br/>'; print_r(session_save_path()); echo '<br/>------------- session_name-------- <br/>'; print_r(session_name()); echo '<br/>------------- $_cookie -------- <br/>'; print_r($_cookie); echo '<br/>------------- $_session -------- <br/>'; print_r($_session); exit;    }  } 

output:

------------- session_save_path--------  \xampp\tmp ------------- session_name--------  ci_session ------------- $_cookie --------  array (     [ci_session] => 2b9tj8rek53kapgsuh4k3v2fuuvblvq9 )  ------------- core $_session --------  array (     [__ci_last_regenerate] => 1479978675 )  ------------- ci $_session --------  ci_session object (  .. values. ) 

ps: have tried explain in best way before down voting please share reason.

as suggested bertmaclin,

ci's session handler wrapper of php session handler

have tweek ci's config.php & session library.

ci config.php: added given code before base_url configuration.

session_start(); 

ci session.php: added @ before session_start() in session library line #142.

@session_start(); 

Comments

  1. Excellent read, Positive site, I have read a few of the articles on your website now, and I really like your style.
    Thanks a million and please keep up the effective work and also get to know about CorePHP Development Company

    ReplyDelete

Post a Comment

Popular posts from this blog

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -

ios - Align baselines with characters in large line heights with Text Kit -