Jump to content

PHP5 Problem?


Drezard

Recommended Posts

Hey I'm wondering with these scripts (http://evolt.org/PHP-Login-System-with-Admin-Features) here how does the Header() function supposed to work? It seems like everyone likes to set cookies and send headers in the middle of there script. Now, did this work in PHP4 or do I need some PERL or Add-on so I can send headers and such. I know u have a FAQ all about this. It just makes no sense about how to fix the problem. Its only a diagnostic.

 

Okay, Please explain...

 

Cheers, Daniel

Link to comment
https://forums.phpfreaks.com/topic/40319-php5-problem/
Share on other sites

You can output headers with Header() as long as you have not yet produced any other output.  Same with cookies.  If it's not working, you need to find where the output has already been produced.

 

You haven't explained what you are trying to do and what is going wrong.

Link to comment
https://forums.phpfreaks.com/topic/40319-php5-problem/#findComment-195086
Share on other sites

You can output headers where ever you like if you use ob_start and ob_end_flush.

 

I used to reserve these for building my cms's as not so many would be in the cms for long periods so I thought it would not matter about server load and runtime etc.  I read an article recently that suggest that if you have lots of output statements all over (echo, print_r etc.) using the output buffer can actually reduce the processing time of the script significantly.  I did a little benchmarking and my results agreed - even on a fairly small script that didn't do too much...

Link to comment
https://forums.phpfreaks.com/topic/40319-php5-problem/#findComment-195089
Share on other sites

You can output headers where ever you like if you use ob_start and ob_end_flush.

 

I used to reserve these for building my cms's as not so many would be in the cms for long periods so I thought it would not matter about server load and runtime etc.  I read an article recently that suggest that if you have lots of output statements all over (echo, print_r etc.) using the output buffer can actually reduce the processing time of the script significantly.  I did a little benchmarking and my results agreed - even on a fairly small script that didn't do too much...

That's a code smell. You should not rely on this.
Link to comment
https://forums.phpfreaks.com/topic/40319-php5-problem/#findComment-195095
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.