Title: Show Display Relative Root Path PHP Function Absolute Path Linux Hosting
Description: show display relative root path php function absolute path linux hosting PHP
Tags: show, display, relative, root, path, php, function, absolute, path, linux, hosting
Info: This Post Has Been Viewed 17516 Times SinceTue Sep 05, 2006 8:48 am Author hostman With 4 Replies #378

Show Display Relative Root Path PHP Function Absolute Path Linux Hosting

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">&lt;&lt; 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.
Comments (4)
View Top Comments
Leave Your Comments...
#1
Innocent:
3 years ago
#45700
Innocent Sun Mar 16, 2008 7:29 am
thanks man - it saved me. i develop my projects on a local machine and have to uplaod the finished projects on different servers - i have always had issues with absolute path. but after now, i will not have those issues any more. thank you and keep smiling. be blessed always.
#2
Rahul:
2 years ago
#97822
Rahul Sat Mar 21, 2009 8:21 am
thankyou. i was looking for this function because mkdir() needs the absolute path.
#3
nero:
2 years ago
#106382
nero Tue Jun 16, 2009 12:04 am
thx u very much, i am very confident that many people make use of this script.


:-)
#4
daniel:
1 year ago
#126765
daniel Tue Jan 26, 2010 1:03 pm
what if i don't want The Absolute Path to show up but instead say mysite dot com ?
Share
| More