Zen Cart Logo
Forums / General Questions / Blank page - Cannot modify header information - headers already sent error

Blank page - Cannot modify header information - headers already sent error

Views: 3,684

Results 1 to 6 of 6
11 Jul 2015, 8:33 PM
#1
laszlo avatar

laszlo

New Zenner

Join Date:
Dec 2006
Posts:
53
Plugin Contributions:
0

Blank page - Cannot modify header information - headers already sent error

Hi All,

I am running Zencart 1.5.4 with the Winchester responsive template. It has been working fine for a while, but today I started getting a blank page on logging in, logging out or adding something to the cart.

I get these messages in the error logs (logs folder):

[11-Jul-2015 21:18:22] PHP Warning: Cannot modify header information - headers already sent by (output started at /usr/local/pem/vhosts/301425/webspace/httpdocs/gifts4baby.ie/includes/languages/english/extra_definitions/winchester_responsive/winchester_responsive_defines.php:1) in /usr/local/pem/vhosts/301425/webspace/httpdocs/gifts4baby.ie/includes/functions/functions_general.php on line 46

People are usually sent to this FAQ page when they get this:

https://www.zen-cart.com/content.php?129-warning-headers-already-sent

So I went and checked the winchester_responsive_defines.php to check out the first line and I don't see any issues with it (extra spaces or anything else). In fact I replaced it with the original one from the Winchester template (I have it customized), and I am still getting the same error.

All I have on the first line is "<?php" (without the double quotes).

So the FAQ does not seem to help me with this problem.

If anyone has any thoughts, it would be much appreciated.

Thanks,

Laszlo

11 Jul 2015, 8:59 PM
#2
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: Blank page - Cannot modify header information - headers already sent error

Hi
Did you check the end of the file also? What were you working on before it started? If you turn the default template back on does the error still occur? What editor did u use to look at the file?

Linda

11 Jul 2015, 9:47 PM
#3
laszlo avatar

laszlo

New Zenner

Join Date:
Dec 2006
Posts:
53
Plugin Contributions:
0

Re: Blank page - Cannot modify header information - headers already sent error

Thanks for the help.

Yes, it works fine with the default template so the Winchester files are at fault.

I use Notepad to edit files. I checked the file again, there are no loose spaces or extra lines.

As I mentioned uploading the original file instead of the modified one does not fix the problem.

I was working on the Winchester slide out menu, its content is defined in includes/languages/english/extra_definitions/winchester_responsive/winchester_responsive_defines.php.

I checked the timestamps of all the uploaded Winchester files and this is the only one I modified recently.

I am at a bit of a loss ...

Laszlo

11 Jul 2015, 10:46 PM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Blank page - Cannot modify header information - headers already sent error

Laszlo:

I use Notepad to edit files.

Bad choice. Notepad messes with the end of line characters and this has been known to cause problems.

Use "Notepad++" instead.

I have a feeling that there is more to this than it may 1st appear though. Your current/live site indicates that it is using your edited file (based on the contents of the slideout menu) and this puzzles me, because the error log is telling us that there is something amiss with this file, so it (your slideout menu changes) shouldn't be working at all.

What happens if you remove this defines file?

The site should still work without it. The only difference you should see is that the 'defines' won't actually be functioning, so instead of (for example) your Categories header reading "Categories", it wiil/should appear as "HEADER_TITLE_CATEGORIES".

Please report your findings as they will (hopefully) provide a further clue.

Cheers
RodG

11 Jul 2015, 11:13 PM
#5
laszlo avatar

laszlo

New Zenner

Join Date:
Dec 2006
Posts:
53
Plugin Contributions:
0

Re: Blank page - Cannot modify header information - headers already sent error

Thanks everyone, it is all fixed now.

I deleted the file and the problem disappeared.

So I installed vim, checked the file with it and there were three characters before <?php that Notepad did not display. I deleted them with vim, and everything works fine now.

Not sure how they got there and how I had it not working with the original unmodified file as well.

Anyway, now it is all fine.

I have been working with Zencart for years and never used any other editor than Notepad for small changes.

Leave and learn, I suppose.

Thanks again:-)

Laszlo

11 Jul 2015, 11:41 PM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Blank page - Cannot modify header information - headers already sent error

Laszlo:

Thanks everyone, it is all fixed now.

Excellent. Thanks fr the update.

Laszlo:

Not sure how they got there and how I had it not working with the original unmodified file as well.

I've no explanation for this as the original file doesn't contain any extraneous characters. Perhaps you viewed it with notepad at some stage and it got automatically resaved? No matter. It's not really important.

Laszlo:

I have been working with Zencart for years and never used any other editor than Notepad for small changes.

I've not used notepad for many years, but it may have an option to change how it deals with the EOL characters, and if so, you may have changed it at some stage so that it doesn't cause this type of issue, and has somehow recently reverted back to its default?

Another possibility for you not having a problem until now could be the files being edited. Many of them will function quite fine even with the extraneous characters EOL characters.

However, I'm not convinced that either of these would apply in this case, because I can't see why Notepad would add characters to the very start of a file.

It could also be related to character encoding perhaps (UTF-8 vs ISO-8859).

We may never really know for sure.

Cheers
RodG