Solved

Converting virtual path to physical path

Posted on 2004-03-22
7
496 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:Andy
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:Andy
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

728 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