Solved

using $_SESSION in mixed codeigniter enivronment

Posted on 2011-09-19
3
696 Views
Last Modified: 2012-05-12
Hello,

I am working on a project that (for some reason) has mixed a codeigniter environment with a standard php environment.  Codeigniter based pages have urls to non-codeigniter pages.

I can't seem to get $_SESSION to work.  Cookies are enabled and the session_start is not called until i enter the non-codeigniter code.

Anyone aware of any issues with $_SESSION getting clobbered or disabled  by codeigniter?

Thanks,
0
Comment
Question by:DanRaposo
3 Comments
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 36567484
Seems that yes there is a problem with CI, as shown in places such as

http://codeigniter.com/forums/viewthread/73057/#361671 (I would test the first solution of simply placing a session_start(); in all CI pages)

http://codeigniter.com/user_guide/libraries/sessions.html indicates that CI manges its own way session data, so you might consider to build a small php that you would include at the start of each php non-CI page.
Seems that http://codeigniter.com/wiki/Native_session/ would give you a nice solution
0
 
LVL 6

Expert Comment

by:jjperezaguinaga
ID: 36570214
Greetings DanRaposo,

I strongly suggest that you use the native session class CodeIgniter provides. $_SESSION has issues with CodeIgniter. There's no point of using a Framework if you are not going to take advantage of its libraries. If I were you, I would give a look to the Session User Guide (http://codeigniter.com/user_guide/libraries/sessions.html) and replace $_SESSION in your application.

Best regards,
-JJ
0
 

Author Comment

by:DanRaposo
ID: 36980267
Gang,

Unfortunately, we inherited a system that is a mix of CI and non-CI.  We'll just have go one way or the other to resolve this.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question