- Forums
- PHP
- Show Display Relative Root Path PHP Function Absolute Path Linux Hosting
This Page Contains information about Show Display Relative Root Path PHP Function Absolute Path Linux Hosting By wallpaperama in category PHP with 4 Replies. [960], Last Updated: Sat May 18, 2024
wallpaperama
Tue Sep 05, 2006
4 Comments
21603 Visits
PHP is great. I just found a function which display the Arbsolute of a file. This function is helpful when you are writing scripts or code in you PHP so that you know what exactly your root absolute relative path is:
getcwd()
-- Gets the current working directory
The only requirement for this to work on your web pages is that you have PHP in your hosting. IF you don't have php, you can signup with www.webune.com for a php plan. if you have php, continue on...
copy and paste this code into your text editor, you can use windows notepad if you like:
<HTML>
<TITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PHP</TITLE>
<HEAD>
<style type="text/css">
<!--
.style2 {color: #0066FF}
-->
</style>
</HEAD>
<BODY>
<strong>Absolute Path Sample Script Showing How To Get Absolute Path In PHP</strong>
<h1 align="center">The Absolute Path is: <span class="style2"><?php echo getcwd(); ?></span></h1>
<div align="center">Turotial by <a href="http://www.wallpaperama.com">Wallpaperama.com</a></div>
<hr size="2" noshade>
<p>This Script was developed by <a href="http://www.wallpaperama.com">Wallpaperama.com</a> - Support us by telling your friends about wallpaperama and help contribut to the open source by adding your knowledge of PHP, Linux, Mysql and more to others, just like this script.</p>
<p>Thank You</p>
<p>Wallpaperama Team</p>
<p><a href="http://www.wallpaperama.com/forums/show-display-relative-root-path-php-function-absolute-path-linux-hosting-t378.html"><< Go Back</a> </p>
<p align="center">PHP Hosting by <a href="http://www.webune.com">Webune.com</a> </p>
<p>
</BODY>
</HTML>
now save the file as : absolutepath.php and upload to your server with php hosting and it will display the directory of the absolute path of where the script is.
Remember, you will need php for this to work, if you dont have php yet, you can sign up at: www.webune.com
This is an example of the output:
The Absolute Path is: /var/www/html/public_files
I hope this helps.