kplonk
asked on
Securing dir
What is the best way to secure a dir that holds some php include files. I am on apache and as such tried .htaccess and so on, the problem is that the parser will not have access either to the files. what to do. Is there a better way.
Basically what i have is a single file with all the db passwords and the link in stored in a dir called secure under my web path and as such is viewable, what i want to do is stop access to this form the out side world, i thought of moving the dir out side the normal web path but hit a problem I use the following code to get a path to the .inc file
$scriptArea = "http://" . $HTTP_HOST . "/secure";
this will not work if I move the dir.
So what is the best way to do this.
Basically what i have is a single file with all the db passwords and the link in stored in a dir called secure under my web path and as such is viewable, what i want to do is stop access to this form the out side world, i thought of moving the dir out side the normal web path but hit a problem I use the following code to get a path to the .inc file
$scriptArea = "http://" . $HTTP_HOST . "/secure";
this will not work if I move the dir.
So what is the best way to do this.
windows or unix?
ASKER
unix
Ok I don't know why I asked because it didn't really matter anyhow :p
Just put the files anywhere outside the /htdocs directory and use the path /home/secure/somefile to access them in your php script, it should work fine.
Just put the files anywhere outside the /htdocs directory and use the path /home/secure/somefile to access them in your php script, it should work fine.
ASKER
/home/secure/somefile this path does not seem to work, is that all i need
$scriptArea = "/home/secure/inc.inc";
is this correct or do i nned to change somthing
$scriptArea = "/home/secure/inc.inc";
is this correct or do i nned to change somthing
You did put the file there right?
"/home/secure/inc.inc";
"/home/secure/inc.inc";
ASKER
yer, but the real path to my site is
/home/sites/site56/scripts
this does not work corectly either do i need some sort ot relitive placer like a ~ or somthing
thanks -k-
/home/sites/site56/scripts
this does not work corectly either do i need some sort ot relitive placer like a ~ or somthing
thanks -k-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I understand that, the proble i have is how to find the path to it. form any where in the web structure. What i dont know is how to do absolut addresssing in php
ASKER
This is the real path
"/home/sites/site56/script s"
Say the script is running at
"home/sites/site56/web/art icle/index .php" real path
"http://www.kplonk.com/article/" web path
and the code of the script "index.php" is
<?php
include "/home/sites/site56/script s/index.ph p";
?>
what am I doing wrong..? thanks
-k-
"/home/sites/site56/script
Say the script is running at
"home/sites/site56/web/art
"http://www.kplonk.com/article/" web path
and the code of the script "index.php" is
<?php
include "/home/sites/site56/script
?>
what am I doing wrong..? thanks
-k-
ASKER
Thanks for the input on moving the scripts out side of the web folder