Jump to content
Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

germ

"Headers already sent..."

Recommended Posts


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Hi Jim,

 

Thank you for the information and the contribution. I have installed it and brought up the output start at folder as mentioned in your read me notes. The following is what comes up when I hit go.

 

I opened the php file and reviewed everything looking for these the comments on the report but there is nothing that has the <?php[0D][0A] or the ?>[0D][0A][0D][0A] mentioned ? I even did a search within the php file.

 

It says that the php file has 91 lines but when I open my php file in code editor it shows my last line to be 90 and it says ?>

 

 

Am I missing something here Jim. Please advise when you have a minute. Thank you so much in advance for provided me with more information. I will also continue to check things in the mean time. I am not sure why this has happened since I have not touched my shipping folders for weeks.

 

 

 

/home/sunshyn1/public_html/includes/modules/shipping/airinternational.php has 91 lines.

The PHP start tag is on line 1.

The PHP end tag is on line 90.

Contents from start of file to the PHP start tag:

 

<?php[0D][0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>[0D][0A]

[0D][0A]

 

 

Error Messages:

 

The closing PHP tag is not on the last line in the file.

 

 

-------------------------

The requested line [92] is out of range.

Share this post


Link to post
Share on other sites

Put your cursor after the ?> and press delete.

 

I know it sounds daft but dont reply on a visual inspection

 

Ricardo


Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Share this post


Link to post
Share on other sites
Put your cursor after the ?> and press delete.

 

I know it sounds daft but dont reply on a visual inspection

 

Ricardo

 

 

Thank you so much Jim & Ricardo. That did the trick. I am up and running again with no errors.

You guys are the best !!!!!! :thumbsup:

Share this post


Link to post
Share on other sites

Hi Guys,

i am haveing a small problem with this addon, i have installed and configured it as per the installing guide. everything shows up ok when i enter it under the admin section.

The problem i have is the editor seems to add extra characters. for example if i type "testing" it comes up as

 

rn testing

rn

 

Any ideas? for some strange reason it seems to be placing Windows Return characters in my text.

 

Regards

 

Bret

Share this post


Link to post
Share on other sites

Hi Guys,

i am haveing a small problem with this addon, i have installed and configured it as per the installing guide. everything shows up ok when i enter it under the admin section.

The problem i have is the editor seems to add extra characters. for example if i type "testing" it comes up as

 

rn testing

rn

 

Any ideas? for some strange reason it seems to be placing Windows Return characters in my text.

 

Regards

 

Bret

I'm thinking you posted in the wrong topic.

:blush:

 

I'll post the contents of the "readme" that is in my contribution so you won't have to download it.

 

"Headers already sent"

----------------------

 

The offical explanation:

 

http://www.oscommerce.info/confluence/display/OSCDOC22/Error+*+Cannot+Add+Header+Information

 

Using osC you can't have output to the browser before the session is started (normally in /catalog/includes/application_top.php).

 

What this really boils down to is the opening php tag ( <?php ) must be at the beginning of the php file, and you cant have anything more that the O/S [eol] after the closing php tag ( ?> ).

 

If you have any blank lines or spaces or other characters (seen or unseen) in front of the opening tag or after the closing tag you can get the "Headers already sent" error.

 

Saving a file in UTF-8 format with the Byte Order Mark (BOM) will also cause this error.

 

The thing about it is since most of the time it's "whitespace(s)" (jargon for "what you can't see") it can be difficult to find the source, let alone fix it.

 

Then to add "insult to injury" the PHP errors that appear on the page aren't much help.

 

A few examples taken from the forum:

 

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/public/www/includes/languages/espanol/modules/payment/transfer.php:19) in /htdocs/public/www/includes/functions/general.php on line 33

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /mounted-storage/myshop.com/index.php(1) : eval()'d code:37) in /mounted-storage/myshop.com/includes/functions/sessions.php on line 102

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/html/includes/functions/database.php:307) in /home/html/includes/functions/sessions.php on line 203

 

Notice that in each case TWO FILES are mentioned! So where does one look?

 

The very simple answer is: ALWAYS look in the file where the error message says "output started at".

 

And at the end of that part of the error message a "line number" is given.

 

I've writen a small helper utility if you have difficulties finding the problem.

 

Upload the headsent.php file in this contribution into your "catalog" folder. Then access it with your browser.

 

You are then presented with a "File:" box, an "Optional Line #:" box and a "Do it" button.

 

Most times just type the the path to the file with the error into the "File:" box then hit [enter] or click the "Do it" button.

 

More on the "Optional Line #:" box later.

 

Let's look at each if the three example errors and I'll expand on the contribution's use.

 

Example No. 1

-------------

 

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/public/www/includes/languages/espanol/modules/payment/transfer.php:19) in /htdocs/public/www/includes/functions/general.php on line 33

 

This person would upload headsent.php into the "www" folder, and in the box type: includes/languages/espanol/modules/payment/transfer.php

 

The offending line in that case is line number 19.

 

Example No. 2

-------------

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /mounted-storage/myshop.com/index.php(1) : eval()'d code:37) in /mounted-storage/myshop.com/includes/functions/sessions.php on line 102

 

This person would upload headsent.php into the "myshop.com" folder, and in the box type: index.php

 

The offending line in that case is line number 1. This shop had been hacked.

 

Example No. 3

-------------

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/html/includes/functions/database.php:307) in /home/html/includes/functions/sessions.php on line 203

 

This person would upload headsent.php into the "/home/html/" folder, and in the box type: includes/functions/database.php

 

The offending line in that case is line number 307.

 

Now, more about the "Optional Line #:" box.

 

Most of the time the "Headers already sent" error is because of "whitespaces" or other content at the beginning or end of a file.

 

I have seen it where there is a php "echo" or other content in the middle of a file that shouldn't be there.

 

Mostly from downloaded contributions where the developer had some "debug" code they forgot to remove before uploading the contribution.

 

So if you have a "Headers already sent" problem with a file and the error is on line number say 199 and the file has say 247 lines you know the problem isn't at the end of the file.

 

And it probably doesn't have 198 blank lines at the beginning of the file so that's where you'd use the "Optional Line #:" box to have the program display that line from the file in your browser.

 

What should the ouput look like when you run the program?

 

Normally like this (UNIX O/S):

 

Contents from start of file to the PHP start tag:

 

<?php[0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>[0A]

 

Or like this (Windowz O/S):

 

Contents from start of file to the PHP start tag:

 

<?php[0D][0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>[0D][0A]

 

If you have a blank line at the beginning of the file it might look like this:

 

Contents from start of file to the PHP start tag:

 

[0A]<?php[0A]

 

If you saved a file in UTF-8 format with the BOM it might look like this:

 

Contents from start of file to the PHP start tag:

 

[EF][bB][bF]<?php[0A]

 

If you have an extra blank line at the end of the file it might look like this:

 

Contents from PHP end tag to end of file:

 

?>[0A][0A]


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

i am having this issue

 

Warning: Cannot modify header information - headers already sent by (output started at /home/iliofosg/public_html/eshop/downunder/includes/template_top.php:14) in /home/iliofosg/public_html/eshop/downunder/includes/functions/general.php on line 35

 

and with the headsent.php i am taking this

 

O/S = Linux.

downunder/includes/template_top.php has 74 lines.

The PHP start tag is on line 1.

The PHP end tag is on line 72.

Contents from start of file to the PHP start tag:

 

<?php[0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>[0A]

[0A]

<div[20]id="contentText">[0A]

 

 

Error Messages:

 

The closing PHP tag is not on the last line in the file.

 

 

-------------------------

Extended contents of the requested line [14] are:

 

<html[20]<?php[20]echo[20]HTML_PARAMS;[20]?>>[0A]

 

-------------------------

Raw contents of the requested line [14] are:

 

>

 

 

What do i have to do?


One amateur made the Arc, 5.000 pro made the Titanic...

Share this post


Link to post
Share on other sites

I have a similar problem. I have deleted spaces on each ends of the file, replaced the languages.php file with one that is exactly the same and working in another site, but still no joy.

 

This is the message received;

Deprecated: Function eregi() is deprecated in /home/woiqqwab/public_html/yebocom/admin/includes/classes/language.php on line 87

 

Warning: Cannot modify header information - headers already sent by (output started at /home/woiqqwab/public_html/yebocom/admin/includes/classes/language.php:87) in /home/woiqqwab/public_html/yebocom/admin/includes/functions/general.php on line 22

 

Any help will be appreciated

 

Regards

 

Felix

Share this post


Link to post
Share on other sites

Your problem is that your server has moved up to PHP 5.3, and you're still running old code that's incompatible with this PHP version. Go searching on "eregi" and you'll find plenty of discussion on it. Once that's fixed, the "Cannot modify header information" error will go away all by itself.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

Having similar trouble (even after using this contrib).

 

Here's the message:

 

Warning: Cannot modify header information - headers already sent by (output started at *******/admin/products_attributes.php:18) in *******/admin/includes/functions/general.php on line 34

 

 

Here is what I got from using the contrib:

 

O/S = Linux.

admin/products_attributes.php has 1047 lines.

The PHP start tag is on line 1.

The PHP end tag is on line 1047.

Contents from start of file to the PHP start tag:

 

<?php[0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>

 

-------------------------

Extended contents of the requested line [18] are:

 

<script[20]type="text/javascript">[0A]

 

-------------------------

Raw contents of the requested line [18] are:

 

 

 

This is what's on line 34 of the admin/includes/functions/general.php file:

 

header('Location: ' . $url);

Share this post


Link to post
Share on other sites

Post the first 25 lines of *******/admin/products_attributes.php


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Hi There, i get this message

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/46/d86206271/htdocs/pete/accuity/catalog/includes/edit-wysiwyg.php:20) in /homepages/46/d86206271/htdocs/pete/accuity/catalog/plad/includes/functions/sessions.php on line 67

 

i plugged includes/edit-wysiwyg.php and i got this answer any ideas please?

 

O/S = Linux.

includes/edit-wysiwyg.php has 27 lines.

The PHP start tag is on line 1.

The PHP end tag is on line 27.

Contents from start of file to the PHP start tag:

 

<?php[20][0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>[0A]

Share this post


Link to post
Share on other sites

Post the whole file (catalog/includes/edit-wysiwyg.php)


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

<?php

 

// this part determines the physical root of your website

// it's up to you how to do this

if (!ereg('/$', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))

$_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].'/';

else

$_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];

 

define('DR', $_root);

unset($_root);

 

 

// set $spaw_root variable to the physical path were control resides

// don't forget to modify other settings in config/spaw_control.config.php

// namely $spaw_dir and $spaw_base_url most likely require your modification

$spaw_root = DR.'spaw/';

 

// include the control file

include $spaw_root.'spaw_control.class.php';

 

// here we add some styles to styles dropdown

$spaw_dropdown_data['style']['default'] = 'No styles';

$spaw_dropdown_data['style']['style1'] = 'Style no. 1';

$spaw_dropdown_data['style']['style2'] = 'Style no. 2';

$copy ="Wysiwyg Editor V1.04 modified SPAW for PHPNuke";

?>

Share this post


Link to post
Share on other sites

The odd thing is i didnt change any files and this error started yesterday, the site has been running for years, please note is is only on the admin panel side of the site not the main customer facing site

Share this post


Link to post
Share on other sites

The real error is here:

 

Warning: main(/etc/apache2/htdocs/spaw/spaw_control.class.php) [function.main]: failed to open stream: No such file or directory in /homepages/46/d86206271/htdocs/pete/accuity/catalog/includes/edit-wysiwyg.php on line 20

 

If you haven't changed anything you may be hacked.

 

I found vulerabilities listed online for spaw_control.class.php

 

If your file hasn't been patched you may be a hack victim.


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Someone changed something.

 

As far as I can tell you don't even have a "catalog" folder on the site.

 

If you have a recent backup start comparing files I guess


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Start by changing this:

if (!ereg('/$', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))

to this:

if (!preg_match('~/$~', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))

 

I presume that this is well after application_top.php has been included, so that $HTTP_SERVER_VARS has been defined for you by osC, even if PHP doesn't supply it. If you are running a very old version of osC, it might be lacking $HTTP_SERVER_VARS when your host upgraded the PHP level. In that case, you've got a LOT of fixing ahead of you.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

Hi there,

I tried using the headsent file but I keep getting

 

550 Can't change directory to /public_html/<: No such file or directory

 

Why is that happening?

Thanks

Share this post


Link to post
Share on other sites

You're giving the script the wrong file pathname.

 

Try it without the /public_html/


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

And if your chasing problems outined in this post you're barking up the wrong tree.

 

Fix the first error and the "Headers already sent" will go away.


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

×