Hi there))

Guys please tell me - how to make reference to directory which is on higher level that site root (by php - site is on local machine) -
may by this situation need some aliases in apache .conf file?
As I see the server(apache) don't want to understand path like "..\scripts"....
what should i do?

big thanks in advance))

Recommended Answers

All 4 Replies

Member Avatar for diafol

I don't understand why you can't access them.

This is an example of me accessing a file in the computer's root directory (c:\) from localhost (C:\xampp\htdocs\mysite\ folder).

echo file_get_contents('../../text.txt');
commented: +++++++++++ +3

thanks for answer))

echo file_get_contents('../../text.txt');

yes)) this variant work in my case too )) - I also have access to all directories , but what about to load page - some file.php from (c:\) (when site root as in your example is on C:\xampp\htdocs\mysite\ folder )
what path you'll see in browser?

to be more concrete - i need to make reference , from (for example) on index.php to some file file.php which is on more higher level that site root (as always - index.php is in site root) -
if you can do thit (make such ref) - please post here pease of HTML with link and path which you'll have in browser adress line after visiting file.php

The whole point of the web root is that web accessible content should be in the web root or lower.

Content above the web root, e.g the server OS and other important files are protected. You can access these protected files via other scripts within the web directory, but you can never access them via the browser directly.

commented: +++++++ +3

The whole point of the web root is that web accessible content should be in the web root or lower.

Content above the web root, e.g the server OS and other important files are protected. You can access these protected files via other scripts within the web directory, but you can never access them via the browser directly.

this's full answer)) thank you, blocblue _))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.