By yubaraj on
There is a problem in my drupal intranet that when i loggin or logout or post any requests or fill up any forms, when action is happened, then the page comes blank. The Page hangs. The type of url that comes after i logout is
/?q=user/login&destination=logout
and the type of url that i get in login is
/?q=user/login&destination=node
and when i refresh the page afterwards, the page becomes fine but i have to do it all the time.
The Error Showing is
Cannot modify header information - headers already sent by (output started at ..........)
Is there any solution that i can overcome with?
Plz, can anybody help me out with this.
Thank You
Comments
have you edited any php file
have you edited any php file by hand?
this will usually happen when you accidentally left a blank space before <?php in any file. check for this.
--
Cheers,
Sivanandhan, P. (a.k.a. apsivam)
www.apsivam.in
Thankx, its done
Thankx
The problem is now no longer. It was the same problem that u have mentioned.
Also for Module developers
This can also happen at the end of the file after the ?> at the end of the file.
I believe this can be any whitespace (both lines and spaces).
It thinks you are tying to add more text to the output.
See also http://drupal.org/node/14802
and
http://drupal.org/node/753#comment-167390
Thanks!!
I created a module and was getting a similar problem Thanks whiteowl
Great post, Thank you.
Great post, Thank you.
all about the spaces
Fixed it.
I had left a blank line in between some php & HTML code -- it looked like every other blank line, but this one had a number of spaces. Took it out and no more problems. :)
had to fix it again
Changed to a different theme, and added some custom content from my desktop, and FTP'd to the server. I started having the same header issues and/or pages would simply load blank anytime I was POSTing input (filling in forms and hitting 'save', for example). I kept checking my customized files for spaces, but they were clean. Turns out the php file was getting modified during or after uploading it to the server. I edited it directly on the server using 'file manager' in cpanel and found the following at the very top of the file:
<?phpThat extra code doesn't show up in Notepad, MS Expression 12.0, or Editplus 2.31, but I can see it on the server and in Editplus 1.25. In other words, most of my editors show the first line as
<?phpOdd.Point: check that your editor isn't jacking up your php files without telling you.
Well I'll be damned. I was
Well I'll be damned. I was having the same issue and was pulling my hair out as to why this issue was coming up and my editor was doing the same thing by putting the
thing in front of the<?phpat the top of my template.php file. I'm glad I came across this topic.WOW!
I was about ready to kill myself. Every time I would a section of code to my template.php I would get
above whatever it was overriding. Went into cPanel and behold there it was.Thank you!!!
Garbled characters caused by Unicode BOM
So glad I found this post. All my code looked fine locally, but once I uploaded it to the server, I started seeing this error on the server.
The characters you are describing is caused by the Byte Order Mark (BOM) in Unicode. I looked back at the file encoding and found it had been converted to UTF-8. I switched out the encoding, reuploaded, and the errors went away.
For more information on the Unicode BOM:
http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
This problem also solved my Blank pages after form submits!
Great post! I had a problem wherby anonymous users would get a blank page after submitting a form i.e. after logging in, or conducting a search.
Anyway I just had to get rid of some spaces before <?php and voila :)
Thanks
Al
Having the Same Problem but...
Hey Guys and Gals Im having the same issue, when i edit a node say
http://mysite.com/sitename/node/10/edit
and then i save the node with via the save button at the bottom it loads a white page this page's url is the same as above
http://mysite.com/sitename/node/10/edit
But nothing is showing , its not redirecting myself or the editor to the content it just loads the blank page.
I leapt into my tpl files and my template.php file to look for spaces in the code prior to <?php tags but there are no spaces. when i go to my log i get these errors
php 05/11/2009 - 09:53 Cannot modify header information - headers ... admin
and in detail it sais
Type php
Date Monday, May 11, 2009 - 09:53
User admin
Location http://mysite.com/sitename/node/10/edit
Referrer http://mysite.com/sitename/node/10/edit
Message Cannot modify header information - headers already sent by (output started at /home3/mysite/public_html/lizzylee/themes/lizzylee/template.php:15) in /home3/artemisb/public_html/lizzylee/includes/common.inc on line 328.
Severity error
Hostname (hidden for security reasons)
Operations
I don't get whats causing the problem , any suggestions?...
I removed the ?> from the bottom of the template.php file
I reckon I added this when I was on a tidy up... not sure why this needs to be omitted off the template.php file - but it is and it works.
I was so frustrated with this but you helped
I had added some custom php code in the top of template.php, and made a blank line before the next <?php. I deleted that line and now it works great! Thanks!
Yup, that solved it for me
Yup, that solved it for me too. Problem was in template.php. Extra spaces at the end so I just removed the ?> at the end of the doc and all is fine. Read somewhere that drupal standard is just to leave that bit off anyway.
Thanks!
Blank Space
Thank you guys. I had mistakenly pasted a whole line on top of my php file and everytime I was logging in the line would show up on top of my site. I was about to go crazy but thanks God I came across this posting
php ini
There are numerous different ways to overcome this problem,
I have posted a full list at Solve "Cannot modify header information".
This not only happens when
This not only happens when you have a blank space before your opening php tag or have included a closing php tag at the end of template.php. It also happens when template.php has utf-8 encoding (might not be true all the time but it was true for my template.php)
This solved things for me.
This solved things for me. Giving it an ANSI encoding fixed things.
Worked for me.
Worked for me.
Also worth running phpmyadmin
Also worth running phpmyadmin to check your tables and then repair errors.
Worked for me after my server fell over, and I knew that no changes had been made to any php files (though of course I checked all the last mod dates first, just in case).
Grep statement to find the culprit php's?
Perhaps someone could post a grep statement to detect the situation? I am having some trouble finding who the culprit is.
strange solution
¡ve been getting the headers already sent a lot lately on webpages that i havent changed in ages. on this code
clerly the setcookie line causing the problem
I do all my html / php using notepad, never anything different. during 15 years.
today out of curiosity i opened one of my files with wordpad, checked there wasnt a space before the <?php and saved it, up'loaded it to the server and the problem was gone.