yarek
yarek

Reputation: 12064

php debugging: how to get a list of all includes or require scripts involved?

I am working on complex php site that uses lots of rewrite rules, includes, requires, classes etc.

What would be the best strategy to print out all included files involved in each php page ?

I need to make some modifications on a page, and I have no idea what php scripts are involved since there are tons of php pages, functions, classes.

Mostly of pages are generated from database, so full text search on php files does not help me a lot.

Any tips / strategy about how to handle such a project ?

Upvotes: 1

Views: 189

Answers (2)

Martin
Martin

Reputation: 22770

https://secure.php.net/manual/en/function.get-included-files.php

This returns you a complete list of all files that are included or required on the current script. You can also use https://secure.php.net/manual/en/function.debug-backtrace.php which can give you useful debug information.

Also there are a host of built in PHP functions that feedback how a page is constructed, using the phrase "get defined..."

Upvotes: 3

nowhere
nowhere

Reputation: 1548

Language constructs can't be extended so I'm afraid the quickest solution would be a quick search/replace on your project and use a different function defined by you:

function newRequireOnce($file){
  echo "\n".$file."\n";
  require_once $file;
}

Upvotes: 0

Related Questions