Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8
Author Message
shmk
Worker
Worker



Joined: Dec 21, 2004
Posts: 116

PostPosted: Thu Sep 22, 2005 1:31 pm Reply with quote

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 ?
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Thu Sep 22, 2005 5:46 pm Reply with quote

can we try?
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Thu Sep 22, 2005 5:50 pm Reply with quote

Could this be the solution to your problem?
[ Only registered users can see links on this board! Get registered or login! ]

montego

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
shmk







PostPosted: Sat Sep 24, 2005 1:38 pm Reply with quote

montego wrote:
Could this be the solution to your problem?
[ Only registered users can see links on this board! Get registered or login! ]

montego


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







PostPosted: Mon Sep 26, 2005 2:15 pm Reply with quote

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







PostPosted: Mon Sep 26, 2005 3:54 pm Reply with quote

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

PostPosted: Mon Sep 26, 2005 3:57 pm Reply with quote

Have your host fix the php.ini file.
 
View user's profile Send private message
shmk







PostPosted: Tue Sep 27, 2005 9:23 am Reply with quote

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 [ Only registered users can see links on this board! Get registered or login! ]
 
Raven







PostPosted: Tue Sep 27, 2005 9:28 am Reply with quote

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







PostPosted: Tue Sep 27, 2005 12:07 pm Reply with quote

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







PostPosted: Tue Sep 27, 2005 8:38 pm Reply with quote

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







PostPosted: Wed Sep 28, 2005 6:30 am Reply with quote

montego wrote:
Might be a good price for YOU

// little OT
That is the main Smile
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 Wink
// end OT
 
Raven







PostPosted: Wed Sep 28, 2005 7:01 am Reply with quote

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







PostPosted: Wed Sep 28, 2005 9:18 am Reply with quote

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 Wink
 
Raven







PostPosted: Wed Sep 28, 2005 10:03 am Reply with quote

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







PostPosted: Wed Sep 28, 2005 12:49 pm Reply with quote

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







PostPosted: Wed Sep 28, 2005 1:02 pm Reply with quote

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







PostPosted: Wed Sep 28, 2005 2:10 pm Reply with quote

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 Smile
 
Raven







PostPosted: Wed Sep 28, 2005 2:15 pm Reply with quote

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







PostPosted: Wed Sep 28, 2005 2:38 pm Reply with quote

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 ? Confused
 
Raven







PostPosted: Wed Sep 28, 2005 3:04 pm Reply with quote

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







PostPosted: Wed Sep 28, 2005 3:41 pm Reply with quote

Raven wrote:
Are you sure your host didn't just change it?


Mmmh don't know... but the error remains Sad
 
Raven







PostPosted: Wed Sep 28, 2005 3:49 pm Reply with quote

Can you PM to me a link to phpinfo() ?
 
shmk







PostPosted: Tue Oct 04, 2005 10:01 am Reply with quote

My theme.php is THIS
 
Raven







PostPosted: Tue Oct 04, 2005 10:04 am Reply with quote

That link is dead. Why are you posting it anyway?
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©