DavidBlezard Posted May 18, 2004 Posted May 18, 2004 I get header already sent errors when I try to include an exteranl php fuile in my main php file. This does not happen on my home server just when I upload to my NEw account at TCH. Does anybody know what I need to do to fix this issue? Quote
Wilexa Posted May 18, 2004 Posted May 18, 2004 Welcome! This probably belongs in a different forum, but I think I can help anyway. It sounds as if you are trying to send a header after some output has already been sent to the page. If I am mistaken, please correct me. Usually this happens when there is an extra line in the include file that just happened to show up during the transfer or edit. It's a weird thing, but it happens to me all the time. Check the bottom of your include file to make sure there are no extra lines after the PHP close tag "?>" at the bottom of your include file. None, nada, zip. Otherwise a blank line is being included. For some reason, Cpanel File Manager loves to add an extra line or two when I edit my files. Other software may do it too, for all I know. If you PM me your URL, I can take a look if you like. HTH, Dave Quote
TCH-Don Posted May 18, 2004 Posted May 18, 2004 How are you linking to the file? like this ? include $_SERVER['DOCUMENT_ROOT']."/path/to/file.php"; moving for better forum organization. Quote
scotttyz Posted May 18, 2004 Posted May 18, 2004 I had the same problem with TCH without using include or require. My fix was to add >php_value display_errors 1 to the end of the .htaccess in the folder of the offending script. It can be a fairly common error in PHP with many server setups EDIT: BTW I was not setting ANY hedder information in the offending script. I am not " ignoring the error may correct it on-screen" Quote
borfast Posted May 18, 2004 Posted May 18, 2004 Welcome to the family, David About the script, can you paste some code here, so we can take a look at it? Remember to strip out sensitive information. Quote
jayseae Posted May 18, 2004 Posted May 18, 2004 It seems that you're sending HTTP header information (for instance, a content-type declaration) after you've already output some data. I had a similar problem with some of my scripts. While ignoring the error may correct it on-screen, it may also prevent the header from being sent, which may cause other problems. Check your PHP and make sure that you are sending HTTP headers _only_ before you send any other information at all. If that isn't clear, post some of your code here so we can see what sort of problem you're having. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.