Page 1 of 1

easy problem...

Posted: Wed Apr 14, 2004 11:08 pm
by nshah
this is just a basic code i got off of a site to see how sessions work in php
unfortunately... i got warnings and errors right off the bat...
can someone help fix these errors?

the code for page1.php

[b]<?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>[/b]


--the following are the warnings i get when executing the above code


[b]Warning[/b]: session_start(): open(/tmp\sess_f743e31918e568464636b50f8b3fbeb8, O_RDWR) failed: No such file or directory (2) in c:\web\page1.php on line 4

[b]Warning[/b]: session_start(): Cannot send session cookie - headers already sent by (output started at c:\web\page1.php:4) in c:\web\page1.php on line 4

[b]Warning[/b]: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\web\page1.php:4) in c:\web\page1.php on line 4
Welcome to page #1
page 2
page 2
[b]Warning[/b]: Unknown(): open(/tmp\sess_f743e31918e568464636b50f8b3fbeb8, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

[b]Warning[/b]: 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


its really frustrating :cry:

Posted: Thu Apr 15, 2004 2:58 am
by markl999
Edit c:\windows\php.ini and change session.save_path from /tmp to :

session.save_path c:\temp
(or some other temporary directory that exists)
Then restart apache (if you're using it).

Posted: Thu Apr 15, 2004 8:49 am
by nshah
well these are the three different ways i tried changing that line in php.ini

session.save_path = "c:\temp"

session.save_path = c:\temp

session.save_path c:\temp

and i restarted apache after trying each one of these

i still came up with these errors

Warning: session_start(): open(/tmp\sess_39cae55f57f184575762f74202c18b2e, O_RDWR) failed: No such file or directory (2) in c:\web\page1.php on line 4

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\web\page1.php:4) in c:\web\page1.php on line 4

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\web\page1.php:4) in c:\web\page1.php on line 4
Welcome to page #1
page 2
page 2
Warning: Unknown(): open(/tmp\sess_39cae55f57f184575762f74202c18b2e, O_RDWR) failed: No such file or directory (2) 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

Posted: Thu Apr 15, 2004 8:52 am
by markl999
Sounds like you might be editing the wrong php.ini file.
Create a <?php phpinfo() ?> page and that will show you which php.ini to edit.

Posted: Thu Apr 15, 2004 9:08 am
by nshah
well i see the phpinfo() on my info.php page.... but i dont know where to look to see whether im editting the rite php.ini file....

Posted: Thu Apr 15, 2004 9:14 am
by markl999
Right near the top of the phpinfo page there's a line that starts with :
Configuration File (php.ini) Path
What does it say to the right of that?

yay

Posted: Thu Apr 15, 2004 9:15 am
by nshah
woah.... yeh i was editting the wrong file.... i found the rite file... and i got it to work.... thanks so much

Neil :D