I’m going through a customer’s server, running crazy proprietary forum
software (vBulletin) and even worse SEO mods (vbseo). I cannot figure
out where the php code for a page is coming from! How to trace this
URL back to a PHP page:
http://www.example.com/forum/members/connie.html
I just joined a project with the code based on a heavily modified vBullitin install with the VBSEO plugin. This particular plugin is horrific spaghetti code with tens of include()s, .htaccess redirects and possibly .httpd.conf changes. Then it pulls strings from a database so I cannot even use grep to find the code file!
Is there any way to stack-trace PHP to log all the code that runs to produce a page? I have root access but I am not supposed to stop or restart the server. A simple list of the include() hierarchy of files that went into producing the page would suffice.
Note that I cannot use debug_backtrace because I don’t know where the code I’m looking for is! The debug_backtrace function is the exact opposite of what I need.
Thanks.
Sounds like you need to step through it with Xdebug. Most common IDE’s support it such as Netbeans and PHPStorm.
Resources:
In both the above mentioned IDE’s, you can CTRL+Click a function/method and it will take you to the line in the file where it is defined. You can also track usages for both functions and variables.
Tracing code is built-in to xdebug. Here’s an example from Zend:
Trace file output: