kingtheoden Posted December 20, 2007 Share Posted December 20, 2007 Sorry to bug you guys with a bit of a newbie crisis... I am working on the PHP for Dreamweaver book and up to sessions. My code is perfect and the author claims there must be something wrong with my computer. Basically, nothing involving sessions functions. However, sessions are enabled. I have my php.ini file in both my php5 folder and sessions path folder. My only guess is that there is a problem with the sessions folder being write protected (the 'read only' check box always is filled, every time I clear it and go to check the properties, the box is filled in). Thank you so much for your help. Jon Quote Link to comment https://forums.phpfreaks.com/topic/82422-solved-local-sever-sessions-not-working/ Share on other sites More sharing options...
papaface Posted December 20, 2007 Share Posted December 20, 2007 Did you restart apache when you changed the php.ini file or anything else? A restart is required to make the changes. Quote Link to comment https://forums.phpfreaks.com/topic/82422-solved-local-sever-sessions-not-working/#findComment-419056 Share on other sites More sharing options...
kingtheoden Posted December 20, 2007 Author Share Posted December 20, 2007 I did a cold boot restart- is that suficient or do I have to stop and start Apache? Quote Link to comment https://forums.phpfreaks.com/topic/82422-solved-local-sever-sessions-not-working/#findComment-419061 Share on other sites More sharing options...
PFMaBiSmAd Posted December 20, 2007 Share Posted December 20, 2007 Check your web server log for errors to get php to help you find what the problem is. There are a number of things it could be and without specific symptoms and the code that is causing those symptoms, no one in a forum can directly guess what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/82422-solved-local-sever-sessions-not-working/#findComment-419065 Share on other sites More sharing options...
kingtheoden Posted December 20, 2007 Author Share Posted December 20, 2007 Dumb question but where is my error log on my local server (on my home computer)? EDIT Here are my sample pages: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Session</title> </head> <body> <form action="session2.php" method="post" name="form1" id="form1"> <label for="name">Name</label> <input type="text" name="name" id="name" /> <input name="Submit" type="submit" value="Submit" /> </form> </body> </html> <?php // initiate session session_start(); // check that form has been submitted and that name is not empty if ($_POST && !empty($_POST['name'])) { // set session variable $_SESSION['name'] = $_POST['name']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Session Test 2</title> </head> <body> <?php // check session variable is set if (isset($_SESSION['name'])) { // if set, greet by name echo 'Hello, '.$_SESSION['name'].'. <a href="session3.php">Next</a>'; } else { // if not set, send back to login echo 'Who are you? <a href="session1.php">Login</a>'; } ?> </body> </html> <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Session Test 3</title> </head> <body> <?php // check whether session variable is set if (isset($_SESSION['name'])) { // if set, greet by name echo 'Hi, '.$_SESSION['name'].'. See, I remembered your name!<br />'; // unset session variable unset($_SESSION['name']); // end session session_destroy(); echo '<a href="session2.php">Page 2</a>'; } else { // display if not recognized echo 'Sorry, I don\'t know you.<br />'; echo '<a href="session1.php">Login</a>'; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/82422-solved-local-sever-sessions-not-working/#findComment-419067 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.