Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 29th, 2003, 05:59 AM
Registered User
 
Join Date: Dec 2003
Location: oakland, ca, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to tanybrw989 Send a message via Yahoo to tanybrw989
Default Warning: session_start():

Hi

I am designing a website with Dreamwearver MX and my database is mysql. Here is the situation dreamweaver sees the database through mysql connection. When I connect the login page script to the database I recieve the following error message when I preview in the browser. See below. Dreamwearver has an extension for PHP called log user in this script connects the login page to mysql database and check to make sure the username and password or in the database. If login is successful then the scrip will send the user to my index.htm page if the login is unsuccessful the script will send to login failure page I have created. Can anyone help figure this out. I have never run into this problems before it is somewhat fustrating.


Warning: session_start(): open(/tmp\sess_5e6f319cf10f6e700f0d6925510cc796, O_RDWR) failed: No such file or directory (2) in d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php:2) in d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php:2) in d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php:2) in d:\hosting\panachereport\members area\signup\TMP58ywnqn5na.php on line 3

Thankyou Tanya



tanybrw989
Reply With Quote
  #2 (permalink)  
Old December 29th, 2003, 11:47 AM
Authorized User
 
Join Date: Jun 2003
Location: San Jose, CA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tanya,

Most of this is probably getting mad at you from the part that says headers already sent. So I'll explain what that is.

PHP has a built in function for sending out HTML headers automatically when it encounters the first "echo" or "print" statement in a file. However if you echo out say the header of the document first, then try to mess with those headers (modifying cookie, redirecting the user, etc.) you will get the "headers already sent" error. You need to make sure that ALL of your sesson code, cookie code and other related code comes BEFORE any actual template or page display stuff. That should help you out some. Hope it helps.

--Chris

----------
~cmiller
Reply With Quote
  #3 (permalink)  
Old December 29th, 2003, 02:52 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Tanya,

Well the trouble here is because your call to session_start() encountered an error, session data not found. When you encoutered the first error, the preceeding errors of headers already sent are encountered because of PHP's output of the first error. SO really the last three errors are irrelevant.

The script is complaining that the session data doesn't exist... and the file path looks a bit screwy.. forward slash / tmp \ backslash session file. Check the session.save_path directive in php.ini and tht PHP has read/write access to the directory. The default configuration should give PHP write access to the tmp directory.

Have you set up custom session handlers? I do hate WYSIWYG editors.. using them sometimes leaves you in the dark as to what's going on under the hood.

So you either need to create the tmp directory with read/write access. Or define the file path in php.ini. under the session.save_path directive. The default should be C:\PHP\sessiondata Or drive letter whereever PHP is installed. To find the php.ini file look in the C:\Windows directory on a Win32 system and open it with a notepad like editor.

If you do not see this directive in the file, then add it as follows:

session.save_path = C:\PHP\sessiondata

Notice this is not delimited by quotes. Again setting file permissions is just as important as the file path.

Also See:
http://www.php.net/ini_set

: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #4 (permalink)  
Old January 2nd, 2004, 03:55 AM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey all,

Just wanted to comment that quesadilla5 is right on the money. You HAVETO have session_path set properly in the php.ini file.

Thanks queso!

-Dan

Reply With Quote
  #5 (permalink)  
Old January 3rd, 2004, 02:30 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Similar problem resolved in this post:
http://p2p.wrox.com/topic.asp?TOPIC_ID=8169

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #6 (permalink)  
Old January 6th, 2005, 09:29 PM
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also, assuming you're using Apache server, make sure that you store the php.ini in the correct location (e.g., C:\Apache\Apache2\bin), otherwise if you're just changing the php.ini in your C:\php folder you'll need to copy it to the location of your Apache2.exe which is in the bin subfolder.
Reply With Quote
  #7 (permalink)  
Old January 12th, 2005, 10:44 AM
Authorized User
 
Join Date: Aug 2004
Location: Yogyakarta, D.I. Yogyakarta, Indonesia.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I ever had the same problem, this is because the value of variables session_path, session_autostart and session_header are not changed. Change the value of session_path to be the directory that saves the cookies, session_autostart to be "1" and session_header to be "on". It will fix your problems...
Best regards

Randhy

Reply With Quote
  #8 (permalink)  
Old April 16th, 2005, 05:08 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey guys, I have a really weird situation, I have read all of the other posts and it seems to be that they only help with local php hosting on your computer, but on my Hosting Provider, these warnings come up :

Code:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/dbzpride/public_html/main.php:5) in /home/dbzpride/public_html/include/session.php on line 39

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/dbzpride/public_html/main.php:5) in /home/dbzpride/public_html/include/session.php on line 39
On the line that it is reffering to on "session.php" (39) this is what is wrote :

Code:
37  function startSession(){
      38  global $database;
      39  session_start();

any help would be greatly appreciated!
Cameron

Reply With Quote
  #9 (permalink)  
Old October 16th, 2007, 03:09 AM
Registered User
 
Join Date: Oct 2007
Location: Batangas, , Philippines.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just like CMILLER said, "You need to make sure that ALL of your sesson code, cookie code and other related code comes BEFORE any actual template or page display stuff."

¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼

Antonio L. Barroquillo Jr.
IT - Manufacturing and Engineering Applications
AMI Semiconductor Phils. , Inc.
Email:    antonio_barroquillo@ amis.com
Mobile    :   6 3 0926 9361550
        &n bsp;     63 0928 3259707
¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼¼
Reply With Quote
  #10 (permalink)  
Old May 10th, 2009, 06:16 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hey

Hi, I am reading over the topic, and i dont under stand because i am getting this problem on my website but on the localhost on my laptop it is fine

PHP Code:
Warningsession_start() [function.session-start]: 
Cannot send session cache limiter headers already sent (output started at /home/hewpargc/public_html/members/compleate.php:2)
 
in /home/hewpargc/public_html/members/auth.php on line 3 

Any one wanna help
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
session_start() changusee2k PHP How-To 2 February 11th, 2006 05:32 AM
Warning: session_start(): khile Beginning PHP 3 August 16th, 2005 04:09 AM
Problem with Session_Start() jmrdeuce32 PHP How-To 2 April 29th, 2005 12:32 AM
Session_Start fires twice!!? Dmitriy Pro VB 6 1 March 17th, 2005 12:59 PM
session_start() problem cfemocha BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 28th, 2004 08:44 AM



All times are GMT -4. The time now is 02:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.