finding directory that a script is running in?

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
toms100
Forum Contributor
Posts: 119
Joined: Wed Feb 26, 2003 10:29 am
Location: Bristol,UK

finding directory that a script is running in?

Post by toms100 »

for the current project im doing,i need to .htaccess protect adirectory so that noone can enter and a php script can pull files from it.
as i want it to be easily instaled, is there a quick and simple way to find the directory a script is running in?
hope someone can help

Tom
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

How about

Code: Select all

<?
print(dirname(__FILE__));
?>
Mark
toms100
Forum Contributor
Posts: 119
Joined: Wed Feb 26, 2003 10:29 am
Location: Bristol,UK

Post by toms100 »

ah ha!!!
thanks very much Bech, worked beautifully ;)

Tom
Post Reply