Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

home directory 1

Status
Not open for further replies.

RobBroekhuis

Technical User
Joined
Oct 15, 2001
Messages
1,971
Location
US
A VERY basic question: how do I refer to the home directory of my server space in my PHP scripts? At the unix prompt, I can type, say, cd ~/includes to get to that place in my local structure. But fopen("~/includes/...") doesn't seem to work. I'm sure there's an easy way...


Rob
[flowerface]
 
The problem is that the "~" shortcut refers to the current user's home directory. That would be the home directory, if any, of the user as which your server runs, not the document root of the current virtual web server.

Try:
$_SERVER['DOCUMENT_ROOT']

Documented here

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Easy indeed - and thanks for explaining why it didn't work.


Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top