Potential Session Problems

There are a few areas where you may have problems when it comes to working with sessions.

The first error message you may see is headers already sent. This is caused by calling the session_start() function after the Web page has received data.

Another problem you may come across is that the $_SESSION variable doesn't exist in your version of PHP. If you have a version prior to 4.1 but after 4.0, you'll need to use slightly different syntax.

If you're running a Windows version of PHP, the first time you try to use sessions, you may see a message like

Warning: failed to write session data ->(files).

To fix this problem, you need to open your php.ini file and change the session.save_path setting to a valid temporary directory on your server. Then restart your Web server.


Sessions in PHP | Introduction | Basic Session Functionality | Creating a Session | Accessing Session Variables | Deleting a Session | Implementing a Login System with Sessions | Saving Arrays in a Session | Using Cookies with Session | Sessions without Cookies | Potential Session Problems
© 2008: Hann So
email: hso@voyager.deanza.edu