Page 1 of 1

Root directory path of server under IIS

Posted: Wed Mar 24, 2004 5:10 pm
by mjseaden
Dear All

This is a sort of spin-off from my previous post, but since the post has gone off on a tangent I felt it would be better to start a new topic related to the subject title.

I'm trying to work out how to express the root directory path of my server (the server is remote to my computer, I upload all my PHP scripts to my remote server and run the server) so I can upload files to a directory called 'tmp' in the root directory of my server space.

However, IIS seems a bit strange and I don't know how to express the file path, so I can upload pictures via the move_upload_file function. I have been told that expressing pathnames is different to how you would for an Apache server.

Does anyone use a Windows-based server, and if so how do you normally express your root directory pathname?

Many thanks

Mark

Posted: Wed Mar 24, 2004 9:44 pm
by Fjook
Hi Mark;
Usually the root path will look something like this:
C:\Inetpub\wwwroot\

However, it would be good if someone else would confirm/correct this. BTW, even on Apache, this is what I use on my Win32 workstation:

C:\Program Files\Apache Group\Apache2\htdocs\...

HTH,
FJook!

Posted: Wed Mar 24, 2004 9:47 pm
by markl999
From the previous post, the problem seems to be that $_SERVER['DOCUMENT_ROOT'] on IIS is returning the path to the file, not the doc root directory.

Posted: Thu Mar 25, 2004 6:52 am
by Fjook
I apologize for that,
Seems that I have misunderstood the questions here. There was no link to the previous post, and I (stupidly) did not check "all posts by.." feature to find it.

But, you are right, I think I do remember this sort of problem when I once worked on IIS, unfortunately I do not have a solution for that.

Yours,
Fjook

Posted: Thu Mar 25, 2004 7:16 am
by mjseaden
Mark, Fjook, thanks for your help.

For reference, the solution to the problem is really the error message I stated on my previous post - i.e. the root is of the form

nasent09\\.....

The long pathname. I sent my hosting company a support mail.

Thanks Mark

Posted: Thu Mar 25, 2004 8:26 am
by hedge
IIS provides different vars than Apache, this is how I do it... this defines a constant to my HOME file system

Code: Select all

if (isset($_SERVERї'DOCUMENT_ROOT'])) define('HOMEFS', $_SERVERї'DOCUMENT_ROOT']);
   else define('HOMEFS', str_replace(str_replace("&quote;, "//",$_SERVERї'PHP_SELF']), "", str_replace("\&quote;, "/",$_SERVERї'PATH_TRANSLATED'])));