Re: General use of rewrite / redirect

From: Date: Tue, 18 Mar 2008 13:54:20 +0000
Subject: Re: General use of rewrite / redirect
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-271719@lists.php.net to get a copy of this message
jeffry s wrote:
Requests are reinitialised, libraries loaded (again), DB connections setup/checked again, session lookups are being done, log write for another request etc.
    
i don't see anything wrong with this since that is the way it is. whether you redirect or not, the script will do DB connection, session lookup anyway. i simply called exit; to stop execution after the header redirect.. sorry.. if i misunderstand your point. but that is just my opinion.. Ok, let me point it out with an example:
include(this); include(that); connect(db); session check That is what normally could exist on a script for every page hit. If you have a page that only does this: if (GET || POST) { process form variables header (location: thankyou) exit } else { whatever } On the thankyou: echo 'thank you' What happens is that just for submitting a form (or any process on any page), most cases all kind of libraries are included, db connection is made, sessions are checked etc. Besides the effect on PHP, the webserver does his job too, writing to logs, creating threads etc. Conclusion is 'load per page'. So what happens in short looks like this: - do heavy stuff - process page - redirect - do heavy stuff - show thank you Why not: - do heavy stuff - process page - show thank you That is my question. How do you people think about the trade-off of performance against the ease of just redirecting to another URL just to be sure a user get's to the right destination? -- Aschwin Wesselius /'What you would like to be done to you, do that to the other....'/

« previous php.general (#271719) next »