Jump to content

find out which files are called


yellowrabbit

Recommended Posts

Hello

 

I have a php website. I am trying to trace (find out) which files are called when a page is displayed.

 

For example on certain pages that get displayed it may call up to 6-7 files. I would like to know the name of the files and the order they are called.

 

As through out the code there is a lot of

 

include_once("global/global.libs.php");

 

Is there any may to easily trace this without having to go through page by page on the code and try to figure out what is happening.

 

Essentially I just want the file name eg global/global.libs.php logged somewhere

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/257902-find-out-which-files-are-called/
Share on other sites

get_included_files only gets the actual files that have been included/required at the time it is called. You would need to use it in a register_shutdown_function to get all the actual included/required files for any particular page request.

 

function shutdown()

{

$included_files = get_included_files();

 

foreach ($included_files as $filename)

{

    echo "$filename\n";

}

}

 

register_shutdown_function('shutdown');

 

and thats how its done the function will only run once the page pas finished all other functions its queued at the end of the process tree in php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.