Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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
 
Old February 9th, 2006, 07:11 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to changusee2k
Default session_start()

[font=Andale Mono]Hi All,
   I'm getting this error, when i try to compile the login.php file locally from my system. I'm giving the error message for your reference.

The warning displayed is
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\Program Files\Apache Group\WEBS\Test\ML_Proj_Chn\login.php:10) in c:\Program Files\Apache Group\WEBS\Test\ML_Proj_Chn\login.php on line 44

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\Program Files\Apache Group\WEBS\Test\ML_Proj_Chn\login.php:10) in c:\Program Files\Apache Group\WEBS\Test\ML_Proj_Chn\login.php on line 44

kindly advise on this.

chandru
 
Old February 10th, 2006, 09:13 AM
Registered User
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try changing to
Code:
<?php
session_start();
rest of script
This is because session_start() needs to be the first line in your php file, as cookie based sessions need to be setup before anything else (even whitespace) is output into the browser.
 
Old February 11th, 2006, 05:32 AM
Registered User
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ajitjana Send a message via Yahoo to ajitjana
Default

You have to write ur session_start()statement on top of your file. After that you can have ur html and php code.

Example:-

<?php
session_start();

?>
<html>
<head>
</head>
<body>
<?php

?>
</body>
</html>

Hope this would help

Ajit






Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: session_start(): khile Beginning PHP 3 August 16th, 2005 04:09 AM
Problem with session_start() jmrdeuce32 Pro PHP 5 June 10th, 2005 01:53 PM
Problem with session_start() jmrdeuce32 Beginning PHP 4 May 8th, 2005 05:09 PM
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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.