Go Back    Forum > Digital Publishing / Web Sites > Website and Server Troubleshooting

LinkBack Thread Tools
10-18-2010, 02:34 AM
admin's Avatar
admin admin is offline
Site Staff | Web Development
Join Date: Jul 2003
Posts: 4,329
Thanked 653 Times in 457 Posts
Sometimes you need to know the full path to a file or directory.
For example, if you wanted to setup .htaccess authentication, you'd need to enter the full path into the .htpasswd file.
If you don't know the full path, and PHP is installed on the server, then you can easily have the server tell you the folder location!

This small PHP script shows the full path of the file (the folder where the file is currently located on the server) when viewed in a browser
PHP Code:
echo dirname(__FILE__);
Copy the code and paste it into a new file named pathtest.php. Either create the new file in your control panel, or create a local file and upload it via FTP -- either way is fine. Then view that file in your web browser (Firefox or Chroma is suggested, not MS IE). Example:
and you'll get something like this displayed in the browser:
That's an example of Linux.
Windows will be in a standard D:\vhosts\mysite.com\etc sort of location.

That's all you need.
When finished, for security purposes, delete that test file. You don't want to freely give hackers information about your site or server structure.

Hope that helps.

- Did this site help you? Then upgrade to Premium Member and show your support!
- Also: Like Us on Facebook for special DVD/Blu-ray news and deals!
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts

Similar Threads
Thread Thread Starter Forum Replies Last Post
What lenses go on full frame DSLR's? beavereater Photo Cameras: Buying & Shooting 1 01-02-2009 02:17 AM
How to use FTP to Connect to a Server lordsmurf Computers 4 07-28-2006 03:39 PM
Server outage information [2006] admin General Discussion 0 03-11-2006 04:06 PM
Convert 16:9 to full screen jrnyhead Encode, Convert for discs 1 05-19-2004 12:07 PM

Thread Tools

All times are GMT -5. The time now is 04:48 AM