context_document_root and document_root not working - local

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

context_document_root and document_root not working - local

Postby kdj127 » 22. May 2014 16:35

I am running XAMPP 1.8.3 with Apache 2.4.9 and PHP 5.5.11 on a local Apache server. The following code I was able to get working on a cPanel server; however, when I decided to move to a local environment, it didn't work anymore

I am using the following code:
Code: Select all
include_once($_SERVER['CONTEXT_DOCUMENT_ROOT'] .'/WMS/configuration.php');

I am using this inside my .htaccess:
Code: Select all
RewriteBase /KyleJ/

With cPanel, my htaccess was: RewriteBase
Code: Select all
and it worked perfectly.

Right now, it is giving me this error (on local environment):

Code: Select all
Warning: include_once(/Applications/XAMPP/xamppfiles/htdocs/WMS/configuration.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/KyleJ/index.php on line 4

Anyone have any suggestions on how to get this to work correctly?

Even document root isn't working:
Code: Select all

I know the file is there, and it is displaying this error:

Code: Select all
Warning: include_once(/WMS/include/database.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/KyleJ/index.php on line 6

Please help!!!
Posts: 1
Joined: 22. May 2014 15:40
Operating System: MAC OSX 10.9.1

Re: context_document_root and document_root not working - lo

Postby Nobbie » 22. May 2014 20:04

$_SERVER['CONTEXT_DOCUMENT_ROOT'] is not a standard Server Variable, maybe cPanel applied to your environment, but it is not part of standard HTTP.

As well "include_once('WMS/include/database.php');" yields to root "/", your local server is completely different configured than your cPanel server. Obviously only "/" is part of the lib_include (whereas cPanel seems to point somewhere else).

We cannot solve this for you, you have to find out, how your cPanel Server is configured and how to overtake the configuration. It is definately a question of server configuration.
Posts: 9419
Joined: 09. March 2008 13:04

Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: Beltran and 2 guests