1. Register a shutdown function ref: http://php.net/manual/en/function.register-shutdown-function.php
  2. Call “get_included_files”
    ref: http://php.net/manual/en/function.get-included-files.php
  3. Save the returned file list to a log somewhere on your server.

This shouldn’t affect the response times – but be warned, it WILL generate higher disk I/O (which might in turn bottleneck at peak usage times).

Don’t let the size of the log file go up too much. Ensure crons/schedulers or any background processes use this shutdown function.


function shutdown()
 $included_files = get_included_files();
 foreach ($included_files as $filename) {
 $xyzzy .= "$filename\n";
 file_put_contents($_SERVER['DOCUMENT_ROOT']."/shutdownlogger/incfiles.txt", $xyzzy, FILE_APPEND );


author image

About Chaitanya Dhareshwar

Chaitanya Dhareshwar, a Technocrat | CIO.

Member of various key technology and management organizations (IETF, ISOC, CSI)
with 14 years of technology management & advisory experience
has transformed companies from "stone age" to "space age". I build high-scale, self-sustaining, self-service platforms. Passionate about technology, innovation and creating killer opportunities that only great tech can bring. I've led teams from 5 - 150 people, and am hands-on with all forms of technology.

You Might Also Like...

The ‘Techie Code’ for Business Leaders
Ensuring data integrity and security
Entrepreneurship to a CIO