SitePoint Sponsor |
|
User Tag List
Results 1 to 10 of 10
Thread: How can I retrieve a file path?
-
Mar 25, 2001, 12:47 #1
- Join Date
- Dec 1999
- Posts
- 137
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Does anyone know how can I retrieve the full path of a file in PHP?. Thanks in advance.
-
Mar 25, 2001, 15:56 #2
- Join Date
- Aug 2000
- Location
- Silicon Valley
- Posts
- 2,241
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't understand what you are trying to do. Do you mean:
$SCRIPT_FILENAME or $PHP_SELF?- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy
-
Mar 25, 2001, 16:18 #3
- Join Date
- Dec 1999
- Posts
- 137
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What I'd like to know is how I can retrieve the path where the script file is located in the server.
Eg: /wwwroot/blahblahblah/myphpfile.php. I know this can be done in ASP using Server.MapPath() but I don't know how to do it in PHP.Last edited by PGA; Mar 25, 2001 at 16:23.
-
Mar 25, 2001, 17:14 #4
- Join Date
- Aug 2000
- Location
- Silicon Valley
- Posts
- 2,241
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Okay, so it's
$DOCUMENT_ROOT or getenv("DOCUMENT_ROOT"); both are equivalent.- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy
-
Mar 26, 2001, 14:26 #5
- Join Date
- Dec 1999
- Posts
- 137
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks Son Nguyen!
-
Mar 26, 2001, 15:04 #6
- Join Date
- Mar 2001
- Location
- Washington State
- Posts
- 70
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Be sure to run the following, it contains some very good information to know about your server :
Code:<?php phpinfo(); ?>
-
Mar 26, 2001, 19:39 #7
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think you mean
<?php
echo phpinfo();
?>
A program which, when executed produces no output, turns a computer into a very expensive source of heat
-
Mar 26, 2001, 21:36 #8
- Join Date
- Aug 2000
- Location
- Silicon Valley
- Posts
- 2,241
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't think you need to echo it, sid.
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy
-
Mar 26, 2001, 23:31 #9
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
oh, yes so I see
the function does the outputing!
How silly of me
-
Mar 27, 2001, 00:24 #10
- Join Date
- Feb 2001
- Location
- El Paso, TX
- Posts
- 16
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes, outputs itself very neatly too, probably one of the most useful features I've found since I started playing with PHP. Great when you want to set up your own box for development, and make sure the environment matches the one you're going to publish to on the web. Makes it very easy to see just how PHP is set up on the server even if you don't have any way to access the actual configuration files.
Bookmarks