Jump to content

[SOLVED] Server and Document Root settings in Apache


kevineugenius

Recommended Posts

I'm not sure if I'm even asking the right question, but my website (not hosted by me) used codes like include $_SERVER["DOCUMENT_ROOT"] . "/include/header.php";.  Per a forum member's suggestion, I ran an echo on that command, and it gives a folder tree three folders deep...  So, online, it points to the correct page, but I'm trying to set up Apache (I used WAMP) to get a beta test site on my own computer.  So, the above command doesn't work.  I ran searches for "document_root" and "php5/pear" (a directory in the error messages I get) to see if I could find a path setting in either Apache or PHP config files with no success.  Does anyone know how to set up either my Apache or PHP config so I can define what $_SERVER and DOCUMENT_ROOT are pointing to when they're on my localhost without making them not work when I upload them to my web host?

Link to comment
Share on other sites

perhaps the folders aren't in the same set up as in your hosted solution.

 

what you'll want to do is find an example case.

 

you say /include/header.php is one of the files it's looking for.

 

so on your local machine, you should have it like this

C:/xampp/htdocs/include/header.php

 

 

your file structure must match what is online, if you want it to work correctly.

 

if this doesn't help, can you paste in some examples of your current hosted file structure and your's (not the full tree please, just enough to see an example)

 

good luck

Link to comment
Share on other sites

I tried both

doc_root = "c:/wamp/www"

and

doc_root = ".;c:/wamp/www"

with no results.

 

I tried uncommenting include_path, I check apache's file for documentroot settings, I can't find anything that isn't set.  You are right, doc_root wasn't set by default, but setting it didn't fix the problem either.

 

Would the problem have anything to do with the $_SERVER variable?

Link to comment
Share on other sites

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.