We help IT Professionals succeed at work.

problem with the session

Y_ee
Y_ee asked
on
Hi I'm new to PHP and I'm trying to use the session_start() and session_register() functions but I always get this error

Warning: open(C:\Program Files\PHP\sessiondata\sess_d2fd40c68495b6ac61ae5c5be5aed868, O_RDWR) failed: m (13) in E:\www\php\session.php on line 2

Warning: open(C:\Program Files\PHP\sessiondata\sess_d2fd40c68495b6ac61ae5c5be5aed868, O_RDWR) failed: m (13) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Program Files\PHP\sessiondata) in Unknown on line 0

I also get this error if I try setCookie() or header()


Warning: Cannot add header information - headers already sent by (output started at E:\www\php\session.php:2) in E:\www\php\session.php on line 3

any idea?

thank you
Y
Comment
Watch Question

Your 2 issues are different:

Your first issue looks to be a permissions problem.  It looks like you are trying to write your session data to C:\Program Files\PHP\sessiondata.  Make sure your webserver is ALLOWED to write to that directory, because it doesn't look to be the case.

Your second issue relates to sending header information.  You will get this error if you try to pass header data after you have already sent content of your page.  Make sure you call ALL header type functions BEFORE you echo, print, etc anything to the user.  Check your files for things like this, or blank lines inside your files.

Let me know what you come up with.

Joe

Author

Commented:
hey thank you very much you saved me some head ache

ciao
Nicola

Explore More ContentExplore courses, solutions, and other research materials related to this topic.