?
Solved

PHP - web hosting account name or root directory

Posted on 2011-09-23
4
Medium Priority
?
347 Views
Last Modified: 2012-05-12
Is there a call to a system function to show the root path.
In the end i need to plug in the username of the account, as in the example below

/home/THISUSERNAME/public_html/

it could even be the path to "this" file and i can then strip off the unneeded subdirectories manually

in order to programmatically generate a root path for PHP files

thanks
0
Comment
Question by:willsherwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
maeltar earned 1600 total points
ID: 36586805
This sill give you the document root..

echo $_SERVER['DOCUMENT_ROOT'];

Open in new window

0
 
LVL 4

Assisted Solution

by:mustang83
mustang83 earned 400 total points
ID: 36586825
$_SERVER["SITE_HTMLROOT"] will give the server root path.

This will only work if you site is not a virtual  or an alias in apache.

There is also dirname which might work

http://php.net/manual/en/function.dirname.php

0
 
LVL 4

Expert Comment

by:mustang83
ID: 36586834
Here is a list of reserved variables that your might find handy.

http://php.net/manual/en/reserved.variables.server.php

0
 

Author Closing Comment

by:willsherwood
ID: 36587587
thanks all - the PHP filesystem root was what i was after
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question