tsangaris Posted November 22, 2015 Share Posted November 22, 2015 Hi there, I have an issue that drives me nuts for some days now. I used php.ini to store the sessions to a folder outside root directory: session.save_path = "/home/castos/SESSIONS" As long as the file i call is in the public_html directory (root), session data are OK. If for any reason i use AJAX to call data from a sub-directory (lets say public_html/ajax/test.php), then SESSION data are no longer there (but the session_id is still the same). If i move the same file inside root (public_html/test.php) and call it using AJAX then it works just fine. I feel that the problem could be inside the configuration of the SESSION in php.ini so i am posting the rest of the session configuration: session.save_handler = files session.use_cookies = 1 session.use_only_cookies = 1 session.name = CUSTSESSID session.cookie_httponly = 1 session.cookie_secure = 1 session.hash_function = sha512 session.hash_bits_per_character = 5 session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = "/" session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440; session.referer_check = session.entropy_length = 256 session.entropy_file = "/dev/urandom" session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 Any help will be much appreciated! Thanks! Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted November 23, 2015 Share Posted November 23, 2015 Sound to me that there is a good chance it could be a permissions issue, Have you set and checked permissions for the offending folder? You should make sure to have both the php and httpd service accounts able to read, write and execute within that folder. It's definitely a quicker and simpler check to start with than going through the ini file. Let us know how you get on. Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted November 23, 2015 Solution Share Posted November 23, 2015 are you changing the master php.ini (this would require owner/root access to the server) or a local php.ini (this would be the case if you only have an account on a shared web server), what is your php version, and is php running as a CGI/FastCGI application on the web server? the most likely reason is you have a case were you are using a local php.ini and it only affects the folder that it is in. try copying the php.ini to the ajax folder or put any files that you are going to be making http requests to in the public_html folder. you may want to see the following section of the php.net documentation for the different server/version configurations that determine how php finds the settings it uses - http://php.net/manual/en/configuration.php Quote Link to comment Share on other sites More sharing options...
tsangaris Posted November 23, 2015 Author Share Posted November 23, 2015 Thank you both for the answers! It turns out that mac_gyver was right. My previous project was on a VPS server, so all i had to do was to only create a php,ini in the root directory. I followed the same philosophy here and that was problem. So lesson learned: On a shared web server i have to copy php.ini on all folders under root -not only root-. Thanks for the link too. Regards, Christos Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.