Author |
Message |
shmk
Worker


Joined: Dec 21, 2004
Posts: 116
|
Posted:
Thu Sep 22, 2005 1:31 pm |
|
A user of my site report me that he see this error on top of the forum:
Quote: | Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/SITENAME/home/themes/THEMENAME/theme.php:122) in /web/htdocs/SITENAME/home/includes/sessions.php on line 239
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/SITENAME/home/themes/THEMENAME/theme.php:122) in /web/htdocs/SITENAME/home/includes/sessions.php on line 240
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/SITENAME/home/themes/THEMENAME/theme.php:122) in /web/htdocs/SITENAME/home/includes/page_header.php on line 484
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/SITENAME/home/themes/THEMENAME/theme.php:122) in /web/htdocs/SITENAME/home/includes/page_header.php on line 490
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/SITENAME/home/themes/THEMENAME/theme.php:122) in /web/htdocs/SITENAME/home/includes/page_header.php on line 491 |
I dont get this error but probably other user yes... someone have a solution ? |
|
|
|
 |
hitwalker
Sells PC To Pay For Divorce

Joined:
Posts: 5661
|
Posted:
Thu Sep 22, 2005 5:46 pm |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Thu Sep 22, 2005 5:50 pm |
|
|
|
 |
shmk

|
Posted:
Sat Sep 24, 2005 1:38 pm |
|
If you have access to php.ini set:
output_buffering = On
--> No I cannot modify php.ini
else copy the following into a file:
PHP_FLAG output_buffering On
save it as .htaccess and upload to the same place mainfile.php is located.
--> I cannot insert .htacces on my hosting server
Or add the following line to mainfile.php right after the file credits:
ini_set("output_buffering","1");
--> tried but users report me that the error remain.
The strange is that not all users seeing that error...
The "full" error is:
Code:Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/sessions.php on line 239
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/sessions.php on line 240
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 484
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 490
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 491
|
|
|
|
|
 |
shmk

|
Posted:
Mon Sep 26, 2005 2:15 pm |
|
Looking in the Error Log of my domain I have found this error:
Code:
[error] [client 62.123.79.XXX] request failed: error reading the headers, referer: http://www.magic-style.org/modules.php?name=Forums&file=viewtopic&t=28911
[Mon Sep 26 22:09:29 2005]
[error] [client 213.140.21.XXX] Premature end of script headers: modules.php, referer: http://www.magic-style.org/modules.php?name=Private_Messages
|
Could it be linked with the other error ? |
|
|
|
 |
shmk

|
Posted:
Mon Sep 26, 2005 3:54 pm |
|
In the apache error log I get these ones too:
Code:
PHP Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/sessions.php on line 239
PHP Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/sessions.php on line 240
PHP Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 488
PHP Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 490
PHP Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.magic-style.org/home/themes/magicstyle_green/theme.php:122) in /web/htdocs/www.magic-style.org/home/includes/page_header.php on line 491
|
I cannot post here my themeheader() function in "theme.php" but I think it's a "normal" one;
the line 122 that make the error is the "print $r_file"; |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Mon Sep 26, 2005 3:57 pm |
|
Have your host fix the php.ini file. |
|
|
|
 |
shmk

|
Posted:
Tue Sep 27, 2005 9:23 am |
|
Raven wrote: | Have your host fix the php.ini file. |
I cannot make them changes it, the php.ini is in common with other hundreds of sites... any other solution ?
You can found the settings on hxxp://62.149.140.18/ver.php |
|
|
|
 |
Raven

|
Posted:
Tue Sep 27, 2005 9:28 am |
|
I understand that. He is being ignorant if he does not have it activated. All good hosts should either have it activated or allow .htaccess modification. |
|
|
|
 |
shmk

|
Posted:
Tue Sep 27, 2005 12:07 pm |
|
If someone need them, these are more information.
The lines that make appear the problem in my error log are:
in ./includes/page_header.php
Code:header ('Cache-Control: no-cache, pre-check=0, post-check=0');
header ('Expires: 0');
header ('Pragma: no-cache');
|
in ./includes/sessions.php
Code:setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
|
in ./theme/MYTHEME/theme.php
Code:$tmpl_file = "themes/magicstyle_green/header.html";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"".$thefile."\";";
eval($thefile);
print $r_file;
|
Quote: | All good hosts should either have it activated or allow .htaccess modification. |
I know... but 50€/year for domain + illimitate space + illimitate bw (best effort) + 100MB of DB MySQL and a couples of emails it's a good price :p |
|
|
|
 |
montego

|
Posted:
Tue Sep 27, 2005 8:38 pm |
|
Might be a good price for YOU, but what about your site visitors??? I am with Raven. There is NO REASON not to allow these things if managed properly.
montego |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 6:30 am |
|
montego wrote: | Might be a good price for YOU |
// little OT
That is the main
If the price wasn't good for me the site never exist and site users too :p
And a error that I can remove with $display_errors = false; in the config file is not a really big problem for that price
// end OT |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 7:01 am |
|
You are hiding the error, yes, but you are not fixing the problem. Output_Buffering FIXES the problem. By not having output_buffering on, your application will not function correctly, even if it seems to. It may in this case, but in a case where multiple headers have to be gathered while interspersed with other browser output, which is very common, even in nuke, it will fail. So, before posting here or anywhere else when you have output problems, consider that. You are definitely sacrificing NEEDED functionality. |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 9:18 am |
|
Raven wrote: | You are hiding the error, yes, but you are not fixing the problem. Output_Buffering FIXES the problem. |
In fact I posted the error to find a solution, not to hide it  |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 10:03 am |
|
I understand and you have been given the solution. I'm just letting you know that by hiding it and not fixing it, you will have other unexplained issues down the line. It's such a simple fix and there is zero security risk for your host to change the output_buffering setting. |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 12:49 pm |
|
Raven wrote: | I understand and you have been given the solution |
No, I haven't found the solution I have found a mode to hide.
I'm continue to search one, if someone can found it (without use of php.ini and .htaccess) please post it...
Quote: | It's such a simple fix and there is zero security risk for your host to change the output_buffering setting. |
I know... but I cannot make them change if they dont want :-p |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 1:02 pm |
|
Quote: | No, I haven't found the solution I have found a mode to hide. |
Shmk,
Let's make no mistake about this. You most certainly have found the solution. The php.ini and/or .htaccess methods are the solution; a legitimate one and one that written for that very purpose by the authors of PHP.
Now, what you are after is a work-around/solution to your hosting company's incompetance, ignorance, or whatever you want to call it. To do that, you will need to recode and review all phpnuke code that uses the header() function. You will then need to rewrite any logic that writes to the browser before the header() function does. Then, you will need to syncronize the different scripts with one another to avoid timing issues between scripts. That's what output_buffering remedies. output_buffering assembles ALL html code before sending it to the browser and then organizes the headers first. |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 2:10 pm |
|
So there isn't another solution (work-around or anything u wanna call) except php.ini or .htaccess ? :-S
Ok so I'll have to hide, thx anyway  |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 2:15 pm |
|
Quote: | So there isn't another solution (work-around or anything u wanna call) except php.ini or .htaccess ? :-S |
Yes, as I posted above, here is the coding solution.
You will need to recode and review all phpnuke code that uses the header() function. You will then need to rewrite any logic that writes to the browser before the header() function does. Then, you will need to syncronize the different scripts with one another to avoid timing issues between scripts. That's what output_buffering remedies. output_buffering assembles ALL html code before sending it to the browser and then organizes the headers first. |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 2:38 pm |
|
A curiosity:
I relooked my php.ini and I have found that output_buffering is set to 4096...
I thought was a boolean true/false setting... what 4096 means ?  |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 3:04 pm |
|
That's what it should be! So we went through all this for nothing. Are you sure your host didn't just change it? |
|
|
|
 |
shmk

|
Posted:
Wed Sep 28, 2005 3:41 pm |
|
Raven wrote: | Are you sure your host didn't just change it? |
Mmmh don't know... but the error remains  |
|
|
|
 |
Raven

|
Posted:
Wed Sep 28, 2005 3:49 pm |
|
Can you PM to me a link to phpinfo() ? |
|
|
|
 |
shmk

|
Posted:
Tue Oct 04, 2005 10:01 am |
|
My theme.php is Only registered users can see links on this board! Get registered or login! |
|
|
|
 |
Raven

|
Posted:
Tue Oct 04, 2005 10:04 am |
|
That link is dead. Why are you posting it anyway? |
|
|
|
 |
|