Comments (7)
this will be available in the "2-full" version/folder
from huge.
Just some info on that: This script uses the php $_SESSION, which "is a file" on the server that temporarely saves information about the user's login status. That's the way a login script works (there are alternatives, but don't let's discuss this here). Problem is, that in cloud applications, the entire app is copied 1:1 to serveral servers automatically to handle big loads/traffic/blabla... So when you enter the app as a user, you are automatically directed to server A, B or C, depending on the load of the servers. The database is usally on another server, let's say D. Now, when you login into the app, maybe on server A, do something and maybe come back to the app 30 minutes later, it's possible that the servers/apps load balancer sends you to server B next time. Problem here: your $_SESSION exists on server A (where you logged in and the session was created) but not on server B. This is a known problem, and it would be interesting to bring up a proper solution.
Note: Some cloud services share the file system for your app, so server a/b/c will have the same php session folder. Some others don't !
from huge.
Some links on that:
http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/
http://stackoverflow.com/q/6490875/1114320
http://stackoverflow.com/q/3480874/1114320
http://www.reddit.com/r/PHP/comments/11p4qs/session_data_when_hosted_on_multiple_servers/
http://phpchunk.net/2012/02/speed-up-your-sessions-part-2-performance/
From a quick research, it looks like saved sessions in the RAM is the way to go. Do cloud servers really share/connect RAM ???
from huge.
not really guaranteed. maybe it would be better if it would depend on availability of either memcache or redis, and only enable shared sessions if those session servers are define()ed or configured.
from huge.
Notice: Works in Google App Engine, as they save in memory: https://developers.google.com/appengine/docs/php/#Sessions
It's also possible to completely change the way sessions are saved (disk, memory, database) by using alternative/own session functions. This might be interesting for people hosting massive apps in clouds: http://php.net/manual/en/function.session-set-save-handler.php
from huge.
I think it's better to close this ticket as this is a high-end edge case problem and not really a topic for a SIMPLE login system. People who really spread their app over multiple servers know what they are doing and have probably a better solution than we would find here...
from huge.
Excellent library for this issue: https://github.com/sprain/PHP-MySQL-Session-Handler
from huge.
Related Issues (20)
- Installation HOT 1
- [QUESTION] PostgreSQL HOT 4
- MySQL connection error HOT 3
- [NOTE] bootstrap.sh HOT 1
- ❤ ! HOT 1
- Changes for Postgres
- Calling model on view?
- Session validation improvement
- Q
- Configuration files
- Configuration files HOT 5
- New user registration issue
- A question about data sent to the view from the controllers HOT 1
- in the encryption.php file HOT 1
- Pagination Class
- Agregar AJAX al proyecto
- Trying to get in touch regarding a security issue HOT 4
- ErrorController redeclaration HOT 2
- PHP code analizing does not work. HOT 3
- Connection problems with MySql (MariaDb)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huge.