Solved

Converting virtual path to physical path

Posted on 2004-03-22
7
476 Views
Last Modified: 2013-11-15
how can get the physical path given the virtual path (http://abc.com/main/)? something like server.mappath() in asp.



Regards
Renjith
0
Comment
Question by:renjith
[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
7 Comments
 
LVL 6

Expert Comment

by:Reapz
ID: 10650030
To get the physical path of the current path you would do...

$path = $_SERVER['DOCUMENT_ROOT'];

... if that helps.
0
 
LVL 6

Expert Comment

by:Reapz
ID: 10650043
I meant to get the physical path of the the current document... Sigh... time for more coffee!
0
 
LVL 10

Accepted Solution

by:
frugle earned 25 total points
ID: 10650593
$_SERVER['PATH_TRANSLATED'] #gives the filesystem based path to the current script, after the server has done any virtual-to-real mapping.

Mike
0
 
LVL 6

Assisted Solution

by:CosminB
CosminB earned 25 total points
ID: 10655443
try this:
<?php
echo __FILE__; // this will give you the absolute path of your file
echo dirname(__FILE__); //this will give you the absolute path of the folder in which your file is located
?>

as for Reapz's answer $_SERVER['DOCUMENT_ROOT'] will give the absolute path of where your web server root is located(the files that will be accessed from "http://somedomain.com/" - that's why it's called document root)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This article discusses four methods for overlaying images in a container on a web page
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
The viewer will learn how to count occurrences of each item in an array.

733 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