| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | What's wrong with session_start()? Hello, This is the code : <? session_start(); ?> When I access this page it gives : Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /mnt/storage/users/c/u/s/customcoding/index.php:1) in /mnt/storage/users/c/u/s/customcoding/index.php on line 1 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /mnt/storage/users/c/u/s/customcoding/index.php:1) in /mnt/storage/users/c/u/s/customcoding/index.php on line 1 To tell you the truth, I'm amazed with the results How can I avoid this ugly error? I believe I shouldn't see it... |
| |
| | #2 (permalink) |
| An American Soldier ![]() | Output buffering is turned off. Contact your webhost and ask him to turn it off. Or you can use the ob_start (); command which will buffer the headers for you. Your Best Friend ------------------------- http://us4.php.net/ob_start
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #3 (permalink) |
| Senior Member | Hello, can you direct me into using ob_start() correctly, I just never used the ob functions. Can you give me a sample code? I tried to put ob_start() above session_start() but nothing. ![]() I do not know if this is a resolution to my current host or not.. I just added error_reporting(0); before session_start(); Correct me please. |
| |
| | #4 (permalink) |
| An American Soldier ![]() | Put ob_start() start above the session_start() after ob_start(); use ob_getcontents(); (i think) after that use ob_printcontents(); (think again) then ob_end() i think they are the right ones, the content ones, check in that outpout buffering link i gave you
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #5 (permalink) |
| Senior Member | let me check, thanks! ![]() Doesn't work now when I try to use header somewhere it says Warning: Cannot modify header information - headers already sent by (output started at /home/designpo/public_html/index.php:1) in /home/designpo/public_html/includes/account_info.php on line 6 |
| |
| | #6 (permalink) |
| An American Soldier ![]() | then u reuse the ob start command.. The easiest thing to do is contact your web host and ask him to turn on php output buffering. If u need a host that has it on. read my sig!
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #8 (permalink) |
| An American Soldier ![]() | check ur pms
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #10 (permalink) |
| Pro Coder & Designer | i think this has been fixed . he found a good host now i guess :P
__________________ Online Dragonball Game |
| |
| | #13 (permalink) |
| Senior Member | as far as I am aware output buffering has nothing to do with sessions (and nothing is mentioned in the php manual). The reason the script failed in the first place was because the script output to the browser BEFORE session was started (even a space output causes this error). The way you have fixed the problem is just a quick and dirty way to go about it and not actually fixing the problem itself. |
| |
| | #14 (permalink) |
| Senior Member | Ok it's a dirty way, and I like it.. anymore comments?
__________________ Custom WordPress theme design. Top notch free WordPress themes Custom Theme Design |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Meta-tags wrong? | FastIcon.com | Marketing Techniques | 5 | 10-27-2004 11:43 AM |
| Push to Wrong Account... What can be done? | Jeanco | Domain Name Discussion | 7 | 12-28-2003 06:43 AM |