PHP - What is auto_prepend_file

Automatically add files before or after any PHP document. Put into your php.ini file:

auto_prepend_file =/tmp/php_auto_prepend_file.php

An associate setting in php.ini:

auto_append_file =/tmp/php_auto_append_file.php

These are handy if you want to run some code before and after all PHP scripts. For example, the content of /tmp/php_auto_prepend_file.php might be:

function log_memory_usage() {
        if (function_exists('memory_get_usage')) {
                $memory_usage = memory_get_usage(true);
                if (function_exists('apache_note')) {

Perhaps, I can also use this to measure how long each script execute, and compare this value with what apache provide (See apache module mod_log_config)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License