Difference between revisions of "How to find your absolute path"
From Joomla! Documentation
m (Adjusted layout) |
|||
Line 1: | Line 1: | ||
− | + | == What is the absolute path? == | |
− | |||
− | |||
The absolute path is the directory location on a server's hard drive where Joomla! is located. | The absolute path is the directory location on a server's hard drive where Joomla! is located. | ||
+ | == Joomla! 1.0 {{JVer|1.0}} == | ||
+ | In Joomla! v.1.0.x the configuration.php file would contain something like the following, however, it can vary depending on your server. | ||
− | == | + | <source lang="php">$mosConfig_absolute_path = '/home/joomla/public_html';</source> |
− | |||
− | + | === Usage === | |
− | |||
− | |||
− | |||
To find out what your absolute path is<ref>[http://joomlatutorials.com/joomla-tips-and-tricks/40-miscellaneous-joomla-tips/110-finding-your-absolute-path.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.). | To find out what your absolute path is<ref>[http://joomlatutorials.com/joomla-tips-and-tricks/40-miscellaneous-joomla-tips/110-finding-your-absolute-path.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. | 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. | ||
+ | <source lang="php"> | ||
<?php | <?php | ||
$path = getcwd(); | $path = getcwd(); | ||
Line 21: | Line 18: | ||
echo $path; | echo $path; | ||
?> | ?> | ||
+ | </source> | ||
'''''IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.''''' | '''''IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.''''' | ||
− | + | == Joomla! 1.5 {{JVer|1.5}} == | |
− | |||
− | |||
− | |||
− | |||
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]]. | 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]]. | ||
− | + | <source lang="php">define('JPATH_BASE', dirname(__FILE__) );</source> | |
− | |||
− | + | === Usage === | |
Use the constant [[JPATH_BASE]]. This constant returns the absolute path to your Joomla! installation directory. | Use the constant [[JPATH_BASE]]. This constant returns the absolute path to your Joomla! installation directory. | ||
+ | <source lang="php"> | ||
<?php | <?php | ||
echo JPATH_BASE; | echo JPATH_BASE; | ||
?> | ?> | ||
+ | </source> | ||
− | + | == See Also == | |
− | |||
[http://forum.joomla.org/viewtopic.php?t=1035 Absolute Path for Joomla! 1.0.x] | [http://forum.joomla.org/viewtopic.php?t=1035 Absolute Path for Joomla! 1.0.x] | ||
− | + | == References == | |
− | |||
<references/> | <references/> | ||
Revision as of 12:48, 17 May 2010
What is the absolute path?[edit]
The absolute path is the directory location on a server's hard drive where Joomla! is located.
Joomla! 1.0 [edit]
In Joomla! v.1.0.x the configuration.php file would contain something like the following, however, it can vary depending on your server.
$mosConfig_absolute_path = '/home/joomla/public_html';
Usage[edit]
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 [edit]
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[edit]
Use the constant JPATH_BASE. This constant returns the absolute path to your Joomla! installation directory.
<?php
echo JPATH_BASE;
?>
See Also[edit]
Absolute Path for Joomla! 1.0.x
References[edit]
- ↑ Finding your absolute path in Joomla! 1.0.x Joomlatutorials