Strange Problem With Php Sesssions

liunx

Guest
My sessions were working fine while running my site on my own computer (PHP 4.4.2, though I'm quite sure the version difference is not a problem).<br /><br />When I got the site up on TotalChoice, I noticed that my sessions weren't quite working (the $_SESSION global was an empty array, after having been set in a login page). After doing some testing, I found that this only occurred in my index.php page in the root public_html directory. I could create another, simple php file to test the session, and it would work fine.<br /><br />So, you would think its something in my index.php code. Well, I copied index.php and renamed the file to something else. The session worked fine with this renamed file, with the exact same code. I then created a very simple script to test a session involving a page that would set a session variable, and another page that would display it. It works fine, unless the displaying page is named index.php, in which case I get the same problem. When I pass the session id to my index.php page in the url, I get the following error: <br /><br />Warning: Unknown(): open(/tmp/sess_8e88a1a24b5744c1f7e488d6becb3cea, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0<br /><br />I decided to test this on another TCH account I have, and I encountered no such problem while using that account. So to sum up: trying to start sessions in a file named 'index.php' or 'index.html' on this account does not work, for whatever reason php is not able to access the session save path while running a script by that name in the public_html directory. I realize that the simplest solution would be to just use a different filename, and that is probably what I'll have to do for now, however that's not the most conveniant solution, and this is an odd problem that I would like to truly fix.<br /><br />Any ideas?<!--content-->
Welcome to the forums P4tr1ck,<br /><br />If you believe this to be s server problem, please start a support ticket and ask the server guys to take a look at the setup (remember to point out it works on the other server)<br /><br />Other then that, are you sure there is nothing else conflicting in the account, e.g. htaccess or web direct?<br /><br />JimE<!--content-->
Welcome to the forum, P4tr1ck. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums P4tr1ck<!--content-->
Welcome to the forum, P4tr1ck <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br />I agree, check your .htaccess file.<!--content-->
Ya, it ended up being something in my .htaccess file. Thanks guys.<!--content-->
Glad you got it working <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br />Thanks for the update.<!--content-->
Good call Jim! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Glad its working!<br /><br />Htaccess is very powerful but can scupper the best laid plans of any website!<br /><br />JimE<!--content-->
 
Back
Top