Finding out current path of script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Trip1
Forum Newbie
Posts: 23
Joined: Sat Jan 25, 2003 7:36 pm

Finding out current path of script

Post by Trip1 »

I have a really easy Q for you guys, looked around for it on google and php.net but couldn't an answer

What i am trying to do is find out the current path of the script im running, and then use the basename function to figure out the base name of the path.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

check this out:
- http://www.php.net/variables.predefined
- http://www.php.net/manual/en/reserved.v ... les.server

Code: Select all

<?php
echo $_SERVER['SCRIPT_FILENAME'];
?>
sleepingdanny
Forum Newbie
Posts: 12
Joined: Thu Mar 20, 2003 4:27 am
Location: Israel

Post by sleepingdanny »

This will show you the path to the script you are running:

Code: Select all

_FILE_
Post Reply