Notice: Undefined index: DOCUMENT_ROOT in C:\\HostingSpaces\\Unlimited\\\\www


I am trying to run php shopping cart at my website and its flagging up with the error I’ve given

Notice: Undefined index: DOCUMENT_ROOT in C:\HostingSpaces\Unlimited\\wwwroot\ e st\plaincart\plaincart\library\config.php on line 18

Please let me know how can I solve it.

// setting up the web root and server root for
// this shopping cart application
$thisFile = str_replace('\\\\', '/', __FILE__);

$webRoot  = str_replace(array($docRoot, '/test/plaincart/plaincart/library/config.php'), '', $thisFile);
$srvRoot  = str_replace('/mydoamin/wwwroot/test/plaincart/plaincart/library/config.php', '', $thisFile);

define('WEB_ROOT', $webRoot);
define('SRV_ROOT', $srvRoot);

// these are the directories where we will store all
// category and product images
define('CATEGORY_IMAGE_DIR', 'images/category/');
define('PRODUCT_IMAGE_DIR',  'images/product/');

Your help would be highly appreciated.

Perhaps this spelling misteak?



Actually, I was hiding my domain name…otherwise domain name is correct.

What does phpinfo() show for the server variable DOCUMENT_ROOT ?

Can you print_r($_SERVER) to see what is there?

Here’s phpinfo for the server I am using:

Well that’s good confirmation that it is not set.

Do you have a DocumentRoot directive in your http.conf file?

But http.conf file is used in apache server

Ahh, you’re using ASP.NET - it was in the phpinfo page too.

I’ll move this thread over to a slightly more appropriate forum so that members there can help further with adding the DOCUMENT_ROOT to your server.


Here’s information about why the problem exists
Untangling the document path with PHP

And here’s an actual solution for dealing with DOCUMENT_ROOT info on IIS systems
PHP DOCUMENT_ROOT in IIS (Windows servers)

Thanks a lot Paul!!