Page 1 of 1

session start problems?

Posted: Wed Nov 12, 2003 10:43 am
by psychotomus
i had this script working a few months ago, then read about some php5 upgrades (not sure if added on my server) but could be the problem since i never took the time to see if anything changed in php5 yet.

code line 1 2 3
<?php
session_start();
?>
then some html
then some more <?php

?>
but problems are on session_start();

Warning: session_start(): open(C:\PHP\sessiondata\sess_f449f5ddd4eb8c78ecf1ad68f387d10a, O_RDWR) failed: Permission denied (13) in C:\webspace\aspweb\po2admin\po2.net\www\update.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\webspace\aspweb\po2admin\po2.net\www\update.php:2) in C:\webspace\aspweb\po2admin\po2.net\www\update.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\webspace\aspweb\po2admin\po2.net\www\update.php:2) in

Posted: Wed Nov 12, 2003 1:31 pm
by JPlush76
have you tried using
ob_start();

right above that session_start() line?

Posted: Wed Nov 12, 2003 1:39 pm
by JAM
Not a headers issue by the look to me, as it sais permission denied. The permission denied msg then creates the headers sendt msg...

Is the server IIS? If so, verify that php/server has write permission in that dir.

Posted: Wed Nov 12, 2003 2:19 pm
by McGruff
For php sessions to work, php must be able to access the folder where sessions are saved. If the current folder has an owner/group different to the php uid, create a folder with mkdir($path, 0755); and use that. Since php created the folder, it will have the php owner/group.

A phpinfo(); will show you the current session save path - edit in php.ini.

Setting a folder to 777 makes it accessible to anything regardless of uid - and that's exactly why you don't want to leave it set to 777, except possibly for a quick test to confirm what's going on.

You can read owner/groups (and modes) for files & folders by connecting with an ftp program and doing a dirinfo or similar.

The header error occurs because an error message has been output to the browser before the session (header) call.