|
|
Php Include Root Ref - whats the root? | ||
Discussion by Lozbo with 6 Replies.
Last Update: May 21, 2008, 12:43 pm | |||
![]() |
|
|
Ive had troubles with this, as it doesnt seem to be working, i have to change to the dot notation (like ../../../../../files/menu.php) in order to keep my includes right. Does any one know what the root is for the include or how can i make a root that always answer to the slash (" / ") location?
Hope i made my self clear.
CODE
<?php
include("include("/home/cpanel login username/www/folder/another folder/filename");
?>
Replace cpanel login username with the username you use to login to cpanel. Replace folder and another folder with actual folder names. filename is the name of the file you are calling in a folder (another folder in this case).
Hope that helps.
Another thing to watch out for is hard coding your username but that isnt really a major problem
I have never had to code anything past the "../filename.php" becuase i use a hierarchy structure. With this host I am not sure yet (havnet got an account) but there should be a folder level somewhere that contains the "www" folder - I have always used the superfolder to hold all the other stuff that i want to keep private from the public but accessable to other files later on. that way all you need is the "../" to get to the root folder past the "www" folder.
Dunno if that will help but it might come in handy later on in your coding expiriences =)
GL
QUOTE (Lozbo)
And what if i have a web where cpanel is not at use? should it be the ftp account? What if its a linux server? What does www mean, will it go to the actual root folder of the web server? Thanks anyway, have not tried but gonna take a look. Thanks:)WOW dude... cPanel is just one of many web hosting control panels out there, they dont effect teh way php runs! Most web servers are linux, www simpkly means default for those with multiple servers...
as snlildude87 said
CODE
<?php
include("include("/home/cpanel login username/public_html/");
?>
php knows that taht means the root folder, for each host this may be different, this is the standard directory structure for cPanel, Plesk is different, for a windows server, it will be like windows is C:/Apache/hosted/user/htdocs/ something liek that
Php Include Root Ref
Genius! Thank you for that Spectre, saved me a LOT of hassle!
-reply by Pete
Similar Topics:
Include File.php?id=something
Installing Phpmyadmin On Local Mach...
To Deploy Php Application Outside H...
Debug The Php Code (4)
|
(1) Cleaning User Input With Regex
|
Loading...
HOME 






