|
ColdFusion
Execute before
| |
When any ColdFusion application page is requested, ColdFusion searches up
the page's directory tree for an Application.cfm file. When it is found,
the Application.cfm code is logically included at the beginning of that
page. You can use a single Application.cfm file for your application, or
use different Application.cfm files that govern individual sections of
the application.
|
Execute after
| |
You can create a file named OnRequestEnd.cfm (it must be placed in the
same directory as the Application.cfm file of the current application
page). It will be executed after each application page in the same application.
|
ASP
Once a script begins execution it continues invisibly in the background
even if the user hits the stop button or moves to a different page on
your site or the web. Any looping actions that could use significant
server resources should therefore contain an explicit check with the
Response.IsClientConnected( ) function to see whether the client is
still connected. That way the process can be terminated if it is
uslessly draining resources for a client that has left the page.
A default ScriptTimeout can be set for a Web Service or Web Server
by using the AspScriptTimeout property in the metabase.
Execute before / after
| |
You can define standard functions to be called before/after the
application or before/after every session as defined by the
Application_OnStart, Application_OnEnd, Session_OnStart, and
Session_OnEnd events. You write these functions in your scripting
language of choice and put them in global.asp.
There is no "Page_OnStart" or "Page_OnEnd" event in ASP. However,
if you build your own COM object for use with ASP you can code
OnStartPage and OnEndPage functions in the COM object (with
exactly those names). Those functions will be called by ASP
before and after the page that uses the COM object runs. Note,
however, that the server does not call the OnStartPage and
OnEndPage methods for objects created with application scope.
If you want a standard code to be executed at the top or bottom
of a page, use a server-side include.
|
PHP
If your PHP page is in the middle of executing and the user hits the
Stop button in the client browser, the default action of PHP is to
abort your program. In some cases it may be preferable for page
execution to finish regardless and you can configure PHP to do that.
In case it gets stuck in an endless loop, or for any other reason,
your script can be terminated by the built-in script timer. The
default timeout is 30 seconds. You can change the timeout limit
with the max_execution_time php3.ini directive or the corresponding
php3_max_execution_time Apache .conf directive as well as with the
set_time_limit() function. When the timer expires the script will
be aborted. If a shutdown function has been registered it will be called.
Execute before
| |
You can always explicitly execute an external PHP file by using an
include() or require() at the top of the page. PHP also provides the
auto_prepend_file directive that can be set in the php.ini file.
This directive allows you to automatically require an external file
at the beginning of every PHP file served.
|
Execute after
| |
PHP provides the auto_apppend_file directive that can be set in the
php.ini file. This directive allows you to automatically require an
external file at the end of every PHP file served.
If you have registered a shutdown function using register_shutdown_function(),
that function will be called at the end of your script terminating normally,
and also after it aborts due to a timeout or if the user hits the STOP button.
To do something different in case of a client diconnect you can use the
connection_aborted() function.
|
|