Zubrag.com
September 25, 2018, 07:23:34 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Warning: Cannot modify header information  (Read 31071 times)
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« on: December 10, 2007, 05:14:03 AM »

A lot of people receiving "Cannot modify header information" error, so i decided to explain it.

Warning: Cannot modify header information - headers already sent by (output started at /home/ahdiorg/public_html/members_area.php:1) in /home/ahdiorg/public_html/pass_protect/ahdi_password_protect.php on line 138

Such error means your script is sending some output before password protector takes control.

Look at your error message.
1. Find the part which is in red color above. This is the name of the program which is causing problems.
2. Find the part which is in green color above. This is the line number in the program which is causing problems.

In above example members_area.php does output something in line 1.

Open program you found on step 1. Make sure protection string is added at the very beginning of the file. It must be first line, no spaces or any other characters allowed before the <?php ...

Logged
gpd
Newbie
*
Posts: 1


« Reply #1 on: April 12, 2009, 12:22:30 PM »

I am experiencing this issue.  I have checked the code several times and can't figure out why it is still doing this.  It is the very first line of code on my page with no spaces or characters before the <?php ... do you have any other suggestions?
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #2 on: May 06, 2009, 04:56:49 AM »

Hello gdp, Are you still experiencing these issues?
Logged

Kara
Newbie
*
Posts: 7


« Reply #3 on: August 17, 2009, 01:44:21 AM »

I am also experiencing this problem.  I have double and triple checked the code, there is definately no characters between the start of the first line of code that shouldnt be there.

Please help!
Logged
Kara
Newbie
*
Posts: 7


« Reply #4 on: August 29, 2009, 07:37:27 AM »

I STILL haven't fixed this.... really need help.

Are these forums even moderated anymore???
Logged
AllMyTrash
Newbie
*
Posts: 1


« Reply #5 on: September 26, 2009, 11:08:53 PM »

I was having this problem and I discovered my problem. The password_protect.php file had a space at the beginning of the file. The first character apparently has to be the < in the <?php command. So, not only does the user page have to begin with the <?php include line, the php file itself can't have anything before the <?php text.
Logged
Kara
Newbie
*
Posts: 7


« Reply #6 on: February 10, 2010, 03:49:54 AM »

None of this has helped me, I still have this issue.

I managed to fix it on one of my .php pages but deleting the <html> bit at the start of the page, but it worked for one area and not the other.

Grrr this is so annoying!  It's affecting my logout page also, and my logout link has stopped working.

Using Micrsoft Expression Web 3 and Internet Explorer 8, although also had these problems on previous Expression Web and IE versions.
Logged
Kara
Newbie
*
Posts: 7


« Reply #7 on: February 10, 2010, 04:01:41 AM »

Ok I have fixed it.... 

Make sure you don't have the <html> header and </html> footer in your files, INCLUDING the passwordprotect.php file  That's what was doing it for me.  All fixed now including my logout links, and also fixed having to login when clicking each link.

Yay
Logged
writerguyfl
Newbie
*
Posts: 1


« Reply #8 on: March 11, 2010, 01:40:15 AM »

I was running into this error and was getting very frustrated.  I checked and rechecked and everything should have worked.  I finally figured out that it wasn't a problem with the script.  Instead, it was a problem with my text editor.  Apparently some text editor add phantom characters to files.  (Don't ask me why or how.)  Here's how I solved my error:

I copy/pasted the code from the file that was causing the problem into Notepad.  Then, I saved file with the appropriate extension (.php, for example).  Once I uploaded that file to the server, the error disappeared.

No guarantee this solution will work for you; but, it's a very simple (& free) thing to try.  FYI: I was coding in Dreamweaver 8.
Logged
Adler
Newbie
*
Posts: 2


« Reply #9 on: May 10, 2010, 09:33:23 AM »

I am experiencing this issue.  I have checked the code several times and can't figure out why it is still doing this.  It is the very first line of code on my page with no spaces or characters before the <?php ... do you have any other suggestions?

yes, a good question to arise
Logged
Adler
Newbie
*
Posts: 2


« Reply #10 on: May 10, 2010, 09:39:26 AM »

It Is Really A Problem  :'(Question to arise
Logged
Kimball342
Newbie
*
Posts: 11


« Reply #11 on: August 12, 2010, 03:24:31 AM »

Its very informative post, nice work done by author, keep it up. Really its admirable post.
Logged
johnzahn2
Newbie
*
Posts: 1


« Reply #12 on: April 01, 2011, 05:51:19 PM »

I managed to solve the problem by removing the document header lines from the "members only.php" AND the password_protect.php pages.  Both files now have <?php  etc as the very first items.  Apparently the pages work all right without document headers!
Logged
traveler
Newbie
*
Posts: 1


« Reply #13 on: October 01, 2011, 05:41:10 AM »

hi,

i have check and used your script and its amazing. but i have little problem. i have one webpage which used headway themes and first i try to put the <?php line on the visual editor(html/php) leaf at the beginning of the page i created. and when i check it is okay. as i enter the username and password the page open i saw the content of the page but at the top error show like this:  Warning: Cannot modify header information - headers already sent by (output started at /home/myaccount/public_html/mydomain.com/wp-content/themes/headway-2013/library/core/layout.php:393) in /home/myaccount/public_html/mydomain.com/wp-admin/password_protect.php on line 98.. i have try all the possibilities, i have edit the layout.php which says in the error. and place the script at the first line without space or character, also modify the html.php at the headway folder  but suddenly the whole site asking for username/password. can you help me on this? thank you
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC