Re: include, relative path
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Tue, 27 May 2008 22:09:26 +0200
^AndreA^ wrote:
On May 23, 5:01 pm, Michael Fesser <neti...@xxxxxx> wrote:.oO(^AndreA^)
Guys, sorry for my lateness... Thank you very much for your answers!An absolute path based on $_SERVER['DOCUMENT_ROOT'] would still be the
At the end I did simple:
include '../libraries/db_details.php';
It seems so simple and sounds strange to me that I didn't try it... I
really don't know what I was thinking that day... ;-)
better and more reliable choice. You also should keep your library
_outside_ the document root for security reasons.
Micha
mmm... interesting...
I didn't use $_SERVER['DOCUMENT_ROOT'] because include '../libraries/
db_details.php'; sounded simpler and also it works on my localhost and
also on the server online so I didn't bother so much... but I'll have
a look on the internet to understand the advantages...
For what regarding security reasons I'm pretty curios, you say I
should keep my library outside the document root...
1) How could I do that?!?
Where do I have to place it and also how to get it outside of the
document root?
On an Unix like system you would have as an user ~/public_html as document root, everything from here and it's sub directories can be accessed with a web browser (we ignore htaccess). If you can access a file, there is two major risks, that the script can be used in a way it wasn't intended to be used as or that the PHP parsing fails, which leads to that the source code is displayed as plain text. To give protection against this, you place your flies in ~/myphpfiles, this directory can't be accessed with a browser, which protects those files from being displayed and makes it more difficult to be exploited.
2) Why for security reasons?!?
Nobody can reach my php scripts on the server... or not?
i.e. I could even write a clear password on a php file... right?!?
The day you update PHP on your system and something didn't go right, even if you think it did, people can see your source code and all your login data, that day you regret that you did write those logins and passwords in your public php files.
There can also be exploits that allows people to display variables, which means they could display your logins and passwords.
--
//Aho
.
- References:
- Re: include, relative path
- From: ^AndreA^
- Re: include, relative path
- From: Michael Fesser
- Re: include, relative path
- From: ^AndreA^
- Re: include, relative path
- Prev by Date: Re: include, relative path
- Next by Date: Re: PHP Auction
- Previous by thread: Re: include, relative path
- Next by thread: Check if string contains matched words.
- Index(es):
Relevant Pages
|