Identifying what’s crap in your BLOATED PHP site and what’s not

  1. Register a shutdown function ref:
  2. Call “get_included_files”
  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 );