Document_root

software development

#1

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!


#2

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


#3

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

Get [color=#00CC00]$97 DISCOUNT[/color] with [color=#CC0000]DISCOMBO97[/color] >> More Codes


#4

tried all three but still no luck :frowning:


#5

Thats strange,

After looking at the index.php I found this:

print dirname($_SERVER[‘PHP_SELF’])==$calendar->htpath? ‘

Document Root is set correctly.

’ : ‘

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

’;

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!


#6

[quote]/calender
/home/.moppy/harvey115/gurunanakdarbar.org.uk/calender

Error: Wrong document root. Ask your host about it.[/quote]
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.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#7

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

Have a look and please tell me where I could do something to make it work!

You will also notice this:
//$this->htpath = ‘/calender’;
$this->htpath = str_replace($docroot, ‘’, $cal_cfg[‘path’]);

this is what I was testing to replace in the calendar.php file and if I do that it works but I am not sure whether it will break the system down or not! please advice

Thanks


#8

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.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#9

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.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#10

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.