Last Updated: February 25, 2016
· cgrusden

Which file is being called by PHP server

When working on a PHP application developed by thirty-other developers before you get to it, things can become hard-to-find or understand, even.

The current project, I couldn't figure out which PHP files were being called when, so I need to see output like Rails does, when it tells you which Controller and Action, but for PHP.

Simple fix:

  • Open your httpd.conf for editing
  • Find the lines where "LogFormat" is defined, it should look something like this:

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

  • Prepend "%f" to the format and it'll show which file is being processed, the finished product should like the below:

    LogFormat "%f %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%f %h %l %u %t \"%r\" %>s %b" common

2 Responses
Add your response

there is "a thing" called xdebug ;)

over 1 year ago ·

Very cool, thanks for that!

over 1 year ago ·