Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Solved: Undefined index: DOCUMENT_ROOT
Total Posts:  47
Joined:  2010-04-09

Every time i got a Magento error it would be on an empty screen

<br />
b>Fatal error</b>:  Uncaught exception 'Exception' with message 'Notice: Undefined index:  DOCUMENT_ROOT  in /docs/magento/errors/processor.php on line 264' in /magento/app/code/core/Mage/Core/functions.php:245
Stack trace
#0 /magento/errors/processor.php(264): mageCoreErrorHandler(8, 'Undefined index...', '/sun/webserver7...', 264, Array)
#1 magento/errors/processor.php(154): Error_Processor->_getIndexDir()
#2/magento/errors/report.php(29): Error_Processor->__construct()
#3 /magento/app/Mage.php(794): require_once('/sun/webserver7...')
#4 /magento/app/Mage.php(606): Mage::printException(Object(Exception))
#5 /magento/index.php(78): Mage::run('', 'store')
#6 {main}
thrown in <b>/magento/app/code/core/Mage/Core/functions.php</bon line <b>245</b><br />

It turns out that since I’m running sun webserver7 PHP is having a similar issue as with ISS. I found the solution here.

I went to /errors/processor.php and added the following code before the return statement:

protected function _getIndexDir()
if ( ! isset($_SERVER['DOCUMENT_ROOT') ) {
'DOCUMENT_ROOT'str_replace'\\''/'substr($_SERVER['SCRIPT_FILENAME']00-strlen($_SERVER['PHP_SELF']) ) );
return dirname(rtrim($_SERVER['DOCUMENT_ROOT'],'/').$this->_scriptName) . '/';

Then I got a nice templated page saying: “Exception printing is disabled by default for security reasons.” so I renamed /errors/local.xml.sample to local.xml. Once I go to production I’ll make sure I
1) Change <action> to email and add email address of a distribution email.
2) Change the templates in /errors/default/

Hope this helps someone!

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top