Root directory path of server under IIS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Root directory path of server under IIS

Post 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
Fjook
Forum Newbie
Posts: 11
Joined: Tue Mar 23, 2004 6:58 am
Location: Toronto, Canada

Post 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!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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.
Fjook
Forum Newbie
Posts: 11
Joined: Tue Mar 23, 2004 6:58 am
Location: Toronto, Canada

Post 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
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post 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
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post 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'])));
Post Reply