473,473 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

access root folder

150 New Member
is code are ok or not [PHP]$_SERVER['DOCUMENT_ROOT'].'armese_data/call/call.php'[/PHP] to access the root folder for security from downloading the files by direct url.
Jul 21 '08 #1
5 2477
webster5u
28 New Member
if i not mistake, in Linux environment $_SERVER['DOCUMENT_ROOT'] will not append / at last character at default directory path.
Jul 21 '08 #2
smartic
150 New Member
what is the alternative for this code to access the root folder?
Jul 21 '08 #3
Atli
5,058 Recognized Expert Expert
The root folder of what?

If you want to access the root directory of your Linux system, simply appending / to any path will jump to the root directory
For example: "/var/www/html"

If you want the web-root, meaning the top level directory accessible from your HTTP server, you could do:
Expand|Select|Wrap|Line Numbers
  1. $_SERVER['DOCUMENT_ROOT'] . "/path/to/file.ext"
  2.  
Jul 23 '08 #4
smartic
150 New Member
my point is how can i access files by php outside the public_html folder like files i want only registerd users only to access it or files i use it for my connection with DB ?
Jul 23 '08 #5
Atli
5,058 Recognized Expert Expert
PHP can access any file on the server's file-system, granted that it has the proper permission.
You can use absolute paths with most of PHP's file functions, such as include and readfile.

Like, say, if you had a DB connection script stored in "/var/www/include", you could simply do:
Expand|Select|Wrap|Line Numbers
  1. include("/var/www/include/dbConnect.php");
  2.  
If your web-root is located at "/var/www/html", and the current script is at the web-root, you could also use a relative path, like:
Expand|Select|Wrap|Line Numbers
  1. include("../include/dbConnect.php");
  2.  
On Windows, using a path like "C:\\SomeDir\myfile.php" should also be perfectly valid.
Jul 23 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nicolae Fieraru | last post by:
Hi All, I am working on a web site in asp which will be hosted on a Windows 2003 server. I use the following code to connect to the database: Set objConn =...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
2
by: HNguyen | last post by:
Hi all, I have a problem with the access to the folder for uploading the file into that folder by using ASP.NET program. The error message was : "Access is denied ..." to the location I save...
19
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However...
1
by: Arun | last post by:
I have a folder “Secured” under the root folder of the project In the project root web.config authentication is given as <authentication mode="Forms"> <forms loginUrl="Login.aspx" timeout="15"...
7
by: Visitor No 3 | last post by:
My local Crinkles group(U3A), of which I am one, want me to develop a noddy database and web site for their members. Some are computer literate, others not so. I thought an Access 2000 .mdb on a...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
1
by: suresh_punniyakkodi | last post by:
Hi, I have one folder if D drive. Ex:- D:\Login I have some sub folders in this Login Folder, Ex:- D: Login (root folder) ...
2
by: krishna81m | last post by:
In a general servlet class after deployment, you can access the application root as servletContext.getRealPath("/") to access any of the properties files in the "WEB-INF" directory or anywhere else...
0
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
I have an exe that runs in the bin folder of the installed application root folder. I need to load some images dynamically which are in a folder called 'images' in a sub folder of the root...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.