How To Find The Absolute Path

Have you ever been stumped in a configuration file or some other installation for a web based program when asked for an absolute path? The thing that you are installing will not work because the application insists on you entering the absolute file path yourself which you simply do not happen to know. There's no way around it, you have to get absolute path to the file or folder where items are going to be stored or used by the application. You are thinking to yourself 'why can't the stupid program figure it out on it's own?' That's not going to be helpful though, you just have to know how to find absolute paths.

Article continues below...

Directional sign
It just can not be found

If the path is unknown to you things won't work.

Step 5 in the installation process when installing Joomla! is the FTP configuration. If you want to 'Enable FTP file system layer' in this step it requires that you input the FTP root path. There is a button labelled 'Autofind FTP Path' but it doesn't always work. It has never worked for me when setting up a local install environment on my Mac using MAMP. Fortunately you don't need this step in order to get Joomla! to install, but if you want the FTP file system layer set up you are going to have to type it in the field required for it. Once you type the absolute path in the FTP root path field there is a button to 'Verify FTP Settings' which does verify the settings when they are correctly input. You can not get past this step with a relative path, it must be the absolute path. It can be really frustrating to find the absolute path. Web hosting services have all kinds of different set ups on how they serve domains on their servers. The path you need can literally be hidden from you.

What is the purpose of the absolute path?

So what is the purpose of the absolute path? The absolute path is a path containing the root directory. The system can find all the other sub directories relative to the root directory once it knows its location. An example of an absolute path vs relative path on a web server would be:

 

Absolute Path:

/home/thedomainname/public_html/cgi-bin

 

Relative Path:

public_html/cgi-bin

 

So this absolute path is what helps the application or system find it's way. Fortunately there is an easy way to figure out what the absolute path is. Joomla! is a php open source content management system. What we need is a php script that will help us determine where the absolute path is on the server. You can easily make this script yourself using the very handy free text editor TextWrangler application from Bare Bones Software. Don't use MS Word for this. You want a simple text editor that will not add, remove, or change characters you type in.

Here is a php script you can use to find the absolute path:


<?php
echo __FILE__;
?>


Save the above file as findpath.php. It is important that you use '.php' (without the quotes) in the file name as you are making a php script file.

You now need to upload this file to your web server. Put this file in the public_html folder of your web server. This will be the root directory of your domain. If you have sub-domains inside that root directory with additional Joomla! installs you will need to put it into the appropriate folder. For the most part, if you only have one domain being served by your web hosting service, it will go in the public_html folder.

How to use this script

To invoke this script and find the absolute path for your Joomla! installation all you need to do is type in your browser window:

http://www.yourdomainname.com/findpath.php

Be sure to change 'yourdomainname.com' to whatever the correct URL is for your domain. When you type this in your web browser it will display the absolute path similar to this:

This Is Your Absolute Path:
/home/yourdomainname/public_html/findpath.php

The part you want is '/home/yourdomainname/public_html'

Where to use this script

If you were trying to find the absolute path for a MAMP localmachine installation you would put the 'findpath.php' file inside your Joomla! installation folder which resides in the htdocs folder of MAMP and the absolute path would look something like this:

/Applications/MAMP/htdocs/Joomla/findpath.php

Of course you could put this file inside a folder in a sub-directory and get the path to that directory. This is very handy for sorting out path issues to bulletin board forums, photo albums, and other applications on your web server.

This Is Your Absolute Path:
/home/yourdomainname/public_html/findpath.php

When you are done it is VERY IMPORTANT that you DO NOT leave this file on your server. If you do it can be a big security risk for you if someone else comes across this file. It could be used to exploit a weaknesses of an application or program on your server that may be poorly written. Be sure to delete 'findpath.php' as soon as you have finished with it.

Go To Top