GithubHelp home page GithubHelp logo

Comments (7)

panique avatar panique commented on July 20, 2024

this will be available in the "2-full" version/folder

from huge.

panique avatar panique commented on July 20, 2024

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.

panique avatar panique commented on July 20, 2024

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.

noodlehaus avatar noodlehaus commented on July 20, 2024

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.

panique avatar panique commented on July 20, 2024

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.

panique avatar panique commented on July 20, 2024

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.

panique avatar panique commented on July 20, 2024

Excellent library for this issue: https://github.com/sprain/PHP-MySQL-Session-Handler

from huge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.