Current location: Hot Scripts Forums » Programming Languages » PHP » Cannot modify header


Cannot modify header

Reply
  #1 (permalink)  
Old 03-07-08, 01:51 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
Cannot modify header

I have a page I'm calling headers on. I'm getting the error
Quote:
PHP Warning: Cannot modify header information - headers already sent by
So i use headers_sent() to see where the issue is. It says line 1. At line 1 I only have a <?php on the line with NO white space before it. more test.. same error. I then remove everything and only have one line of code with a header(Location:http://www.blabla.com) on line 1. Again no white space before or after PHP. Still the same error.

Why is this happening? Why are my headers failing? Thanks much.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-07-08, 02:25 AM
nova912's Avatar
nova912 nova912 is offline
Code Guru
 
Join Date: Sep 2004
Location: Traverse City, MI, USA
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
1) Post your code, copy/paste it in.

2) The cause might be that there is an invisible character before the "<?php". Some text editors or IDEs can do some odd things. To see if this is the issue, open a new file, type (don't copy/paste) your code in -- just the part causing the problem -- and see if your are still getting the error.
__________________
"BTW, I can't program at all the only thing I figured out is how to upload templates to my server."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-07-08, 02:40 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
1) Post your code, copy/paste it in.
Code is fine. like i said in my post... even a plain header(Location:..) no worky.

Quote:
2) The cause might be that there is an invisible character before the "<?php". Some text editors or IDEs can do some odd things. To see if this is the issue, open a new file, type (don't copy/paste) your code in -- just the part causing the problem -- and see if your are still getting the error.
!!!!!!!!!!! ITS WORKING. Thanks so much. Your right there must have been a funky invisible character in the code. Thanks so much for this so easy solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-07-08, 02:42 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
since there was a lot of code to re-type, first i tried just grabbin all code, minus the first and last character, then added into a new file and saved over the old... Yeah!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-07-08, 02:50 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
Found the problem. Thanks to all those that helped.

Basically there was some type of invisible character in the beginning of my file. I copied all of the file but the first and last character, then pasted into a new doc. Saved over the old doc and it works!

I'm using EditPlus3 text editor in case anyone knows why this invisible char was added.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 03-07-08, 03:17 AM
nova912's Avatar
nova912 nova912 is offline
Code Guru
 
Join Date: Sep 2004
Location: Traverse City, MI, USA
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
The reason i asked you to copy/paste the code in was to see if the post would pick up the character; not because I suspected your code was wrong.

I'm glad you solved the issue =)

I use GoLive CS2 (only for the php fill in feature) and it has thrown that shit at me a few times.
__________________
"BTW, I can't program at all the only thing I figured out is how to upload templates to my server."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Header File Questions newyorkmetz12 C/C++ 1 10-20-07 11:17 AM
Warning: Cannot modify header information - headers already sent by!!! help!!!! Enigma122 PHP 4 11-10-06 07:02 PM
Warning: Cannot modify header information GrnEydGuy PHP 4 03-09-06 01:45 AM
Warning: Cannot modify header information - headers already sent by netbakers PHP 1 07-09-05 01:55 AM
cannot modify header kalinchuk PHP 13 06-02-05 02:18 AM


All times are GMT -5. The time now is 12:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.