Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.