How to use/access a directory above the web root?

Posted on 2009-04-27
Last Modified: 2013-12-12
Hi experts,

I'm trying to create a script to ease the connection to MySQL for my users (without having to download an ODBC driver). And I've created a php-script that creates XML files out of the MySQL queries.

It works fine at the moment, but I'm concerned about the security and wonder if I could save the files to a directory outside the web root and access it from there instead. I've been googling the matter, but not found a solution.

I assume in PHP I would just save the XMLs to "/home/safedir/" instead of "/home/www/" but how would I connect to it again from an offline application (Excel VBA)? Is it even possible?

Question by:Gaute Rønningen
    LVL 14

    Expert Comment


    you can use include() method.

    for example: include('/root/filename1');  (in /var/www/html/filname.php)

    Author Comment

    by:Gaute Rønningen
    Yes, but if I should use MSXML2 in Excel then I would need an url to insert into the DOMDocument.
    What would that url be if I store it on a safedir? Or do I have to create another script to get it from the safedir?
    LVL 14

    Expert Comment


    Please clarify tour need?
    LVL 5

    Accepted Solution


    You would put your file into your safedir, then use another script to retrieve the contents and pass them back, using something like file_get_contents.  This way, the file is still available, but it isn't sat on a public url.  You can then use sessions or similar to control access to the proxying script.


    Author Closing Comment

    by:Gaute Rønningen
    Was as I suspected, just needed to know if there was any other way of doing it. Thanks. :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
    The viewer will learn how to dynamically set the form action using jQuery.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now