Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following log entry:

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

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

share|improve this question
up vote 1 down vote accepted


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.


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

The content of `foo.php



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

This means:

  • someone browsed to the page
  • 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

Your Answer


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.