Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following log entry:

[Thu Oct 11 01:02:03 2012] [error] [client 127.0.0.1] PHP Fatal error:  Class 'Mage' not found in /var/www/foo/bar/Mage/Core/functions.php on line 244, referer: http://example.com/de/checkout/cart/

Is the referer shown in this message really the HTTP referer or actually the URL where the error happend?

share|improve this question
add comment

2 Answers

This means:

  • someone browsed to the page http://example.com/de/checkout/cart/
  • and the server probably responded with index.php or the like
  • which in turn called/included /var/www/foo/bar/Mage/Core/functions.php
  • which called for a class called Mage, which doesn't exist
share|improve this answer
    
Are you sure? So it wouldn't be the HTTP referer but the request URL instead. Actually further investigation on the server showed that the problem did not happen in the checkout/cart but in a page referred by checkout/cart - so I think you are wrong. Feel free to correct me :-) –  Alex Oct 12 '12 at 17:07
add comment
up vote 1 down vote accepted

Referer = HTTP_REFERER

The referer entry in the error log really referes to the page referring to the script (HTTP_REFERER) and not the script where the error actually happend.

Verification

I just tried it by creating a file foo.html with a hyperlink to a file foo.php

The content of `foo.php

<?php

foobar();

What I get in the Apache error log is:

PHP Fatal error:  Call to undefined function foobar() in /var/www/foo.php on line 3, referer: http://localhost/foo.html

How to find out which script caused the error

If the error is nested deep inside an PHP app, the .php file name mentioned would not be identical with the request URI. To find out the request that caused the error, we can look in the access.log and try to find an entry with the same or similar time and date (it looks that even the time and date can differ, depending on execution time)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.