Jump to content

$_SYSTEM['document_root'] missing slash (or has extra slash)


Recommended Posts

I'm making a clone of a website I've made on another server using the same LAMP distrobution (xampp). 

I use the line

require_once $_SERVER['DOCUMENT_ROOT']."../admin/somefile.php";

(I put my admin files outside of the document_root

 

This works fine on the first server I set it up on.  $_SERVER['DOCUMENT_ROOT'] has a slash added to the end of it on Server A

 

But on Server B, I get an error because I it tries to require '/blah/blah/blah../admin/somefile.php'  and there's no directory 'blah..'  it should be 'blah/..'

 

Please let me know if there's a setting to add that slash back to the end, I really don't want to change some unimaginable amount of lines to add one slash, and have to remember to do that everytime I update Server B.

 

Thanks!

Open up the httpd.conf file for Server B and just add a forwardslash to the end of the DocumentRoot directive. Save httpd.conf and restart Apache. $_SERVER['DOCUMENT_ROOT'] should now end paths with forward slash.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.