| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | What's wrong with session_start()? Hello, ????: NamePros.com http://www.namepros.com/programming/103289-whats-wrong-with-session_start.html 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) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | THREAD STARTER #3 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | THREAD STARTER #5 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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!
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | #8 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | check ur pms
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | #10 (permalink) |
| Pro Coder & Designer Join Date: Apr 2005 Location: Netherlands
Posts: 967
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | i think this has been fixed . he found a good host now i guess
__________________ aween web development |
| |
| | THREAD STARTER #12 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Yea, it's been fixed now as xlusive said.. it was something with the host, that output buffering is Off, which globally turns off all session_start() usage. Thanks though; Ahmed |
| |
| | #13 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | THREAD STARTER #14 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Ok it's a dirty way, and I like it.. anymore comments?
__________________ WP Theme Developer Your One-stop for Premium Magazine/CMS WordPress Themes Deluxe Themes |
| |
![]() |
| 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 12:43 PM |
| Push to Wrong Account... What can be done? | Jeanco | Domain Name Discussion | 7 | 12-28-2003 07:43 AM |