 |
| Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 2nd, 2004, 07:19 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
More session_start() probs
Hi guys,
Am trying to get this to work ~ but with no joy.
I have set the php.ini value for the session.save_path as follows:
session.save_path = C:\WINDOWS\Temp
but am still getting these errors:
Code:
Warning: session_start(): open(/tmp\sess_52f39f6d3b5cd8bccc6a77fd6bc53638, O_RDWR) failed: No such file or directory (2) in c:\program files\apache group\apache\htdocs\test.php on line 1
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\apache group\apache\htdocs\test.php:1) in c:\program files\apache group\apache\htdocs\test.php on line 1
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\test.php:1) in c:\program files\apache group\apache\htdocs\test.php on line 1
Warning: Unknown(): open(/tmp\sess_52f39f6d3b5cd8bccc6a77fd6bc53638, 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
any ideas, am missing something more fundamental ?
appreciate any feedback and thanks in advance :D
|
|

January 2nd, 2004, 09:58 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
This looks suspiciously like another post.
http://p2p.wrox.com/topic.asp?TOPIC_ID=8046
Could you post your session accessing code? It seems there is more to this from the look of your error output than a simple call to session_start()... well the first error... the other errors are output directly because of the first error.
Some suggestions:
1. I don't think that the Windows Temp directory is the best place to store PHP session data.. I couldn't really say if that would have an effect on garbage collection in PHP or Windows either one, but it would be best to use a completely dedicated directory to avoid possible conflicts. I would use something elsewhere perhaps near your www directory, or in the PHP program folder, (wherever web users cannot access the files from a browser of course!).
2. You need to set read/write permissions on the session data directory for a custom session directory to work. I can walk you through that if you're using Windows XP, but I'm not sure how to do it on older versions.
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
|
|

January 3rd, 2004, 05:39 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Rich,
Thx for your post, i did read thru the other post and and thought fixing the session path would do it.. I have just re-read and seen:
Quote:
quote:
Again setting file permissions is just as important as the file path
|
I am using xp and would appreciate your help on this..
:D
|
|

January 3rd, 2004, 11:17 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
Ok in Windows XP all you have to do is enable 'Allow network users to change my files' under the sharing and security tab in a folder's properties menu.
So to get there you run explorer from :
Start->Run->Explorer-> Navigate to Folder ->Right click on folder->Properties->Sharing-> Enable 'Share this folder on the network' and 'Allow network users to change my files' -> Apply/OK
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
|
|

January 3rd, 2004, 01:44 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
nope, still no joy, set path to c:\temp, made it shared and allow users to change files, but still get the following error message:
Warning: session_start(): open(/tmp\sess_548cf26a7b0f827d0114cd5973859839, O_RDWR) failed: No such file or directory (2) in c:\program files\apache group\apache\htdocs\sessions.php on line 1
my code is:
Code:
<?session_start();
//store default ftp conn deets in session
$_SESSION['ip'] = '127.0.0.1'; //will be passed from a form not hard coded
$_SESSION['port'] = '666';
$_SESSION['user'] = 'test';
$_SESSION['pass'] = 'test';
?>
|
|

January 3rd, 2004, 01:58 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
Did you try restarting the server and starting on a totally new request? The only thing I can think of is its trying to find session data related to an older attempt.
If that doesn't work --
Have you modified any other session-related directives?
Do you have plenty of extra harddisk space?
One more suggestion:
PHP Short tags are *not* good programming practice (e.g. <? ?>) ! IMO I would stick with <?php ?> for portability purposes. Short tags can be deactivated in php.ini. ; )
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
|
|

January 3rd, 2004, 02:00 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
question, if my php.ini file pionts to: session.save_path = c:\temp
why does the error say session_start(): open(/tmp\sess_ ??
|
|

January 3rd, 2004, 02:03 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
rich u are a star !!
simple server restart and all is ok :)
will revert to <?php ?> rather than short tags ,
thanks again for your support (stoopid noob questions)
|
|

January 3rd, 2004, 02:10 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
Great to hear its working!
Quote:
quote:
question, if my php.ini file pionts to: session.save_path = c:\temp
why does the error say session_start(): open(/tmp\sess_ ??
|
I was trying to figure that out myself to no avail. So I have no idea why it says that. The 'sess_' portion is appended to the beginning of the session_id to create the file name. You should be able to open the session directory and see the session files being created.
...stoopid noob questions
lol, not really, I've been programming PHP for a couple of years now and still regularly have moments of simple problems that take far too long to solve!
Glad to be of help!
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
|
|

December 13th, 2004, 09:13 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey there, I have a similar problem. I read your thread and I tried and tried again, but I just can't get to work properly. I assume from your discussion above that it is a matter of configuring my php.ini correct. But what exactly should I change. I get this error when I try to start a session.
Quote:
quote:
Warning: session_start(): open(/tmp\sess_feca9157b135688cfa2c90d792c070bc, O_RDWR) failed: No such file or directory (2) in c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php on line 67
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php:67) in c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php on line 67
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php:67) in c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php on line 67
|
and in the end f the page I get this message
Quote:
quote:Warning: session_write_close(): open(/tmp\sess_feca9157b135688cfa2c90d792c070bc, O_RDWR) failed: No such file or directory (2) in c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php on line 106
Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in c:\inetpub\wwwroot\catalog\includes\functions\sess ions.php on line 106
|
/asbjoern
|
|
 |