user3850805 user3850805 - 1 year ago 113
Ajax Question

SESSION lost after location.reload()

I am trying to make login using ajax to send username and password to my php script for checking if there is any record in database, on my ajax success i want to reload the page in order to show something if session is created. I use session start on very top of my pages. Also on local server my login works perfect, but on ipage server i have this problem with losing session...(i tested it using var_dump($_SESSION) and its always

array (size=0) empty
I have also tried using this on my very top of pages:

session_save_path("your home directory path"/cgi-bin/tmp);

but this also didn't work...
Also i have tried to change
but still same.

I am sorry for my bad English.

I`ve tried using form to create login but same issue still going on. Its clear now that something with the server is wrong.(maybe with the php.ini)

Answer Source

It turns out that my host changed servers and started using a different session save path other than /var/php_sessions which didn't exist anymore. A solution would have been to declare ini_set(' session.save_path','SOME WRITABLE PATH'); in all my script files but that would have been a pain. I talked with the host and they explicitly set the session path to a real path that did exist. Hope this helps anyone having session path troubles.

Location of session folder:


location of index.php


What I placed in index.php at line 0:

ini_set('session.save_path',realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../session'));

This is the only solution that worked for me. Hope this helps someone.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download