Actions

Difference between revisions of "How to find your absolute path"

From Joomla! Documentation

(Category added)
Line 1: Line 1:
Take notepad or any other text editor and insert:
+
== Using Joomla Find Your Absolute Path ==
  
<source lang="php">
+
=== What is the absolute path? ===
<?php
+
The absolute path is the directory location on a server's hard drive where Joomla! is located.
  $p = getcwd();
+
  echo $p;
+
?>
+
</source>
+
  
save as detection.php (or first as txt and rename to detection.php) and upload it to the root directory of your site with ftp. Run it as http://example.com/detection.php and you have your absolute path.
+
 
 +
=== Joomla! 1.0.x ===
 +
In Joomla! v.1.0.x the configuration.php file would be something like the following, however, it can vary depending on your server.
 +
 
 +
<code>$mosConfig_absolute_path = '/home/joomla/public_html';</code>
 +
 
 +
 
 +
==== Usage ====
 +
To find out what your absolute path is<ref>[http://www.joomlatutorials.com/faq/view/joomla_beginner/what_is_my_absolute_path?/60.html Finding your absolute path in Joomla! 1.0.x] Joomlatutorials</ref>, copy the following code into a text editor (i.e. Notepad, TextEdit etc), save the file as a .php naming it whatever you want (i.e anyfilename.php.).
 +
 
 +
Using your FTP software, ftp the file you have just created to your root folder. Open a web browser and type in http://www.yourdomain.com/filename.php.
 +
 
 +
<?php
 +
    $path = getcwd();
 +
    echo "Your Absoluthe Path is: ";
 +
    echo $path;
 +
?>
 +
 
 +
'''''IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.'''''
 +
 
 +
 
 +
----
 +
 
 +
 
 +
=== Joomla! 1.5.x ===
 +
In Joomla! v.1.5.x the absolute path is set in the index.php (<small>line 17</small>) file in the base directory to the constant [[JPATH_BASE]].
 +
 
 +
<code>define('JPATH_BASE', dirname(__FILE__) );</code>
 +
 
 +
 
 +
==== Usage ====
 +
Use the constant [[JPATH_BASE]]. This constant returns the absolute path to your Joomla! installation directory.
 +
 
 +
<?php
 +
    echo JPATH_BASE;
 +
?>
 +
 
 +
 
 +
=== See Also ===
 +
[http://forum.joomla.org/viewtopic.php?t=1035 Absolute Path for Joomla! 1.0.x]
 +
 
 +
 
 +
=== References ===
 +
<references/>
  
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks 1.0]]
 
[[Category:Tips and tricks 1.0]]
 
[[Category:Tips and tricks 1.5]]
 
[[Category:Tips and tricks 1.5]]

Revision as of 03:29, 15 January 2009

Contents

Using Joomla Find Your Absolute Path

What is the absolute path?

The absolute path is the directory location on a server's hard drive where Joomla! is located.


Joomla! 1.0.x

In Joomla! v.1.0.x the configuration.php file would be something like the following, however, it can vary depending on your server.

$mosConfig_absolute_path = '/home/joomla/public_html';


Usage

To find out what your absolute path is[1], copy the following code into a text editor (i.e. Notepad, TextEdit etc), save the file as a .php naming it whatever you want (i.e anyfilename.php.).

Using your FTP software, ftp the file you have just created to your root folder. Open a web browser and type in http://www.yourdomain.com/filename.php.

<?php
   $path = getcwd();
   echo "Your Absoluthe Path is: ";
   echo $path;
?>

IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.




Joomla! 1.5.x

In Joomla! v.1.5.x the absolute path is set in the index.php (line 17) file in the base directory to the constant JPATH_BASE.

define('JPATH_BASE', dirname(__FILE__) );


Usage

Use the constant JPATH_BASE. This constant returns the absolute path to your Joomla! installation directory.

<?php
   echo JPATH_BASE;
?>


See Also

Absolute Path for Joomla! 1.0.x


References

  1. Finding your absolute path in Joomla! 1.0.x Joomlatutorials