title: How to figure out what code include'd specified .php file?
body: <p>I have a third-party web server with Ubuntu 14.04 and PHP 5.5.3 running some wordpress stuff. Using logs I figured out what some <code>.php</code> file seems to be a part of a backdoor/spambot and sending a spam. But according to website architecture this file must not be included at all. I can add code to that file and require a stacktrace:</p>
  
  <pre><code>$e = new Exception;
  file_put_contents('/tmp/debug.log', $e-&gt;getTraceAsString());
  </code></pre>
  
  <p>But stacktrace contains only:</p>
  
  <pre><code>#0 {main}
  </code></pre>
  
  <p>It seems that file is included or required from a top-level scope. Is it any way for me to figure out where a file is required from? Like name of <code>.php</code> file and a line where <code>require</code> or <code>include</code> is called?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Since I have two answers suggesting <code>debug_backtrace</code> I must clarify that it's same as <code>getTraceAsString</code> and evaluates to an empty array (I tested it manually).</p>