Home » Php » sqlite – What is the best session save_handler for PHP and why?

sqlite – What is the best session save_handler for PHP and why?

Posted by: admin July 12, 2020 Leave a comment

Questions:

There are many ways to save sessions in PHP. To save them into files has some problems — e.g. it’s not a scalable solution. What is the best way to store sessions in PHP? I found out it’s very easy to get working saving sessions into SQLite, which is at least more compact than thousands of files, but it seems not many people does it. Why? They don’t know about it, they don’t matter, or it’s not way better than files? Do you have experience with memcached, redis? I have my own server and I am not satisfied with saving sessions into pure simple files.

Thanks for any suggestions!

EDIT: The question is: What is the “best” session save_handler for PHP and why? I am interested in answer, which sums up possibilities and lists some pros&cons for each of them. I quoted “best”, because I know it is application dependent, but I am interested in information which approach is best for which types of apps.

How to&Answers:

Its better not to store sessions in files to avoid scalability problems. I would suggest to use database for storing the sessions. Frameworks like Zend, Symfony, etc provides the facility to store them in database.