I have been looking on the web for some time now and HTML5 local storage seems to look like something useful to me and a solution to my problem that I am having with PHP sessions, the problem is that they are not consistent even if I set them to remember me the next time I come to my home page I am taken to the login page, this is not always, but often, PHP sessions are proving inconsistent for me.
I would like to know if i can use local storage for consistent session storage that php can use, all the examples i have seen on the web use javascript.
Localstorage is for saving data client side so that it can be accessed even if the client is offline, in which case it is accessed, as you said, using JavaScript.
PHP sessions store information on the server. Using localStorage is also a bad idea because it can be modified by the client, so the client could claim to be logged in as a different user which is obviously a security issue.
Is there a problem with your PHP configuration? Is there a timeout value for the PHP session cookie that you can change?
No. PHP runs on the server and has no access to the local storage API of the browser.
I have had this happen to me and it seems that the server decides to randomly clean up PHP sessions. I think it does this when it is having memory issues...which is why its random and having nothing to do with timeout settings. When this happens to you , can you associate it with a high load that may have happened on the webserver between the time you were logged in last ( or last held a session) ?
Anyway, Since its all javascript there is no reason why you can't use PHP to output your js that gets and sets data to localstorage.