document_root

document_root

Posted by: harvey115
Posted on: 2007-04-13 07:14:00

Hello everyone,

I am quite rusty in the php part so would really appreciate your help.

I have been trying to install this free calender script written in php (http://winged.info/project/calendar). In the installation part it tells to load the folder and do all the chmod's and after that view the file in the browser. In step 4 it mentions about the error someone might get, guess what I am that person getting this error.

It does give any hint what this variable may hold and only tells me to ask from my host, I thought it might be better to also ask the forum. So, here is the url of the script on my domain (http://www.gurunanakdarbar.org.uk/calender/). It shows me that the document root is set incorrect, so I decided to test $cal_cfg['document_root'] = ''; with inserting my http://www.domain.org.uk. but it does not likes it. What it does when I click on any date from the calender url it tries to open pages with this url(http://www.gurunanakdarbar.org.uk/home/.moppy/harvey115/gurunanakdarbar.org.uk/calender/calendar_handle.php?add=14-4-2007)

I am actually running out of ideas, and don't know what there should be entered.

Really appreciate any help thanks!

Re: document_root

Posted by: misterhaan
Posted on: 2007-04-13 07:57:00

here's a few guesses you could try:

$cal_cfg['document_root'] = 'calender';
$cal_cfg['document_root'] = '/calender';
$cal_cfg['document_root'] = $_SERVER['DOCUMENT_ROOT'] . '/calender';

track7 - my dream-hosted site

Re: document_root

Posted by: monkeyboy7706
Posted on: 2007-04-13 08:03:00

Looks like its getting it wrong I don't think the www.gurunakdarbar.org.uk should be at the beggining. I think the document root should be something like /home/username/domain with in this case /calender added to the end.

So your document root should be /home/harvey115/gurunanakdarbar.org.uk

Re: document_root

Posted by: harvey115
Posted on: 2007-04-13 08:04:00

tried all three but still no luck :(

Re: document_root

Posted by: harvey115
Posted on: 2007-04-13 08:10:00

Thats strange,

After looking at the index.php I found this:

print dirname($_SERVER['PHP_SELF'])==$calendar->htpath? '<p>Document Root is set correctly.</p>' : '<p>Error: Wrong document root. Ask your host about it.</p>';

it's trying to find if the php_self is equal to the doc root, to produce the error. so even after inserting:
$cal_cfg['document_root'] = '/home/harvey115/gurunanakdarbar.org.uk';
it still does the same thing!

Re: document_root

Posted by: seiler
Posted on: 2007-04-13 08:33:00

In reply to:

/calender
/home/.moppy/harvey115/gurunanakdarbar.org.uk/calender

Error: Wrong document root. Ask your host about it.


I'd take out .moppy/. That must be hard-coded in there somewhere, since the document_root variable wouldn't show it.

If you click a date, you get a 404--but the gurunanakdarbar.org.uk/calender/calendar_handle.php file is there, so that makes me think .moppy/ might be throwing it off.

That should be left out anyway, since it could change and mess things up later.

$_SERVER['DOCUMENT_ROOT'] should just be /home/harvey115/gurunanakdarbar.org.uk

I also notice that when you click a date, you end up at a URL like this:

http://gurunanakdarbar.org.uk/home/.moppy/harvey115/gurunanakdarbar.org.uk/calender/calendar_handle.php?add=12-4-2007

So it looks like "/home/.moppy/harvey115/gurunanakdarbar.org.uk" is also added somewhere that it doesn't need to be.

Also, to avoid possible confusion later, keep in mind that you're spelling it calender and they spell it calendar.



Re: document_root

Posted by: harvey115
Posted on: 2007-04-13 08:53:00

It just feels like that there is something to do with dreamhost as the insatllation of the script is fairly straigh forward with not much to edit from the script. Below are the list of files converted into text files:
http://www.gurunanakdarbar.org.uk/calender/config.txt
http://www.gurunanakdarbar.org.uk/calender/calendar.txt
http://www.gurunanakdarbar.org.uk/calender/calendar_handle.txt
http://www.gurunanakdarbar.org.uk/calender/index.txt
--------installation guide-------
http://www.gurunanakdarbar.org.uk/calender/README.txt

Re: document_root

Posted by: seiler
Posted on: 2007-04-13 12:16:00

At a quick glance, htpath is probably supposed to be either /calender or http://www.gurunanakdarbar.org.uk/calender/ -- rather than the path on the server.

I'd try those.

Also, that second url returns a 404 because the file name is actually calender.txt instead of calendar.txt. Maybe just a typo in the post, but I'd probably go through everything and make sure you don't use one spelling in one spot and the other somewhere else.

There must be something screwy in their code though, if they're predicting a possible problem defining the document_root right in the installation guide.

If you changed something and it works, I'd probably just leave it if there aren't any other problems.

Re: document_root

Posted by: scjessey
Posted on: 2007-04-14 06:45:00

I can't be bothered to read through this entire thread, but the only document root variable I am aware of is:

$_SERVER['DOCUMENT_ROOT']

Note the capitalization.

Re: document_root

Posted by: harvey115
Posted on: 2007-04-14 09:15:00

Thanks a lot guys, that is only a post typo the "calender" thing. I think I will give that a shot making htpath equal to the calender folder as it worked previousy, but I was just thinking there might be a better way then editing unrecommended code. So will let you guys know if anything goes bad doing so!

Thanks a lot for the replies.

Tags: org ukguesswww domaincfgchmodi decided