Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.