Replacing CodeIgniter’s session by PHP’s Native Session
For last 8 months, I have been working on a web application. We are developing the application based on CodeIgniter framework. In our project there are normal web version and mobile view version. Some days ago we noticed that, some people can’t login their account via mobile version though there username & password are correct. After debugging and digging the problem we found that in iPod Touch 2G/3GS Safari browser, this problem is happening.
We are using CodeIgniter’s built in session library and that is different than normal PHP’s session. We found that for each visit of the user, the server can’t track the session and regenerating new session id each time. Very weird situation for us. As we coded all over based on CodeIginter’s session library’s function so its not optimal solution for us to remove the codes and use PHP’s native session. Because in that case there is high possibility to generate new bugs. After lots of searching in the net at last we found a wrapper class for CodeIgniter.
This wrapper class is named Native session . It uses the same functions name like CodeIgniter’s Session class, but it used PHP’s native session on the back end. As our project is running on Dedicated Server so we are not worried about the session security. We replaced CodeIgniter’s Session class by this Native session class and it solved our problem.
So if you’re facing this type of session related problem by using CodeIgniter’s Session library, you can use the Native session library to fix the problem. Hope it helps.