[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Securing dir

Posted on 2002-04-19
10
Medium Priority
?
301 Views
Last Modified: 2006-11-17
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.
0
Comment
Question by:kplonk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 4

Expert Comment

by:Gibble
ID: 6969105
windows or unix?
0
 

Author Comment

by:kplonk
ID: 6970037
unix
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6971196
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kplonk
ID: 6975548
/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
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6977255
You did put the file there right?
"/home/secure/inc.inc";
0
 

Author Comment

by:kplonk
ID: 6977286
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-
0
 
LVL 4

Accepted Solution

by:
Gibble earned 30 total points
ID: 6977312
move the file out of there, put it wherever on the HD, just not in your web directory if you don't want it web accessible, the PHP files should still read it.
0
 

Author Comment

by:kplonk
ID: 6978474
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
0
 

Author Comment

by:kplonk
ID: 6983019
This is the real path
"/home/sites/site56/scripts"
Say the script is running at
"home/sites/site56/web/article/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/scripts/index.php";

?>

what am I doing wrong..? thanks
-k-
0
 

Author Comment

by:kplonk
ID: 6987534
Thanks for the input on moving the scripts out side of the web folder
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question