access with PHP a sensitive passwords files, eg db.php, outs

Alles, was PHP betrifft, kann hier besprochen werden.

access with PHP a sensitive passwords files, eg db.php, outs

Postby lse123 » 03. March 2015 20:38

The way access with PHP a sensitive passwords files, eg db.php, outside web reach is the same in a VPS LAMP like XAMPP?

How do this in XAMPP?
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Nobbie » 04. March 2015 18:50

Sorry, but i do not understand that question. There is no "PHP behaviour" for Password files, it behaves like you have programmed the PHP Script.
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04

Re: access with PHP a sensitive passwords files, eg db.php,

Postby lse123 » 05. March 2015 17:49

No.. I mean - I keep password vars for MySQL - in a separate PHP file.
How put & access this file out of web reach/access...?
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Nobbie » 06. March 2015 16:46

Put the outside of DocumentRoot, PHP can access the file normally via full pathname.
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04

Re: access with PHP a sensitive passwords files, eg db.php,

Postby lse123 » 07. March 2015 14:33

can you provide a file structure with full pathname? full pathname from where?

C:\xampp\htdocs\siteY\index.php how access from here db.php?
C:\xampp\db.php
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Nobbie » 07. March 2015 16:38

lse123 wrote:can you provide a file structure with full pathname? full pathname from where?

C:\xampp\htdocs\siteY\index.php how access from here db.php?
C:\xampp\db.php


Example:

In C:/xampp/htdocs/siteY/index.php you can include db.php:

Code: Select all
<?php

include "C:/xampp/db.php";
...
?>
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04

Re: access with PHP a sensitive passwords files, eg db.php,

Postby lse123 » 07. March 2015 20:09

ok I WILL TRY SOON....
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby cmb69 » 13. March 2015 03:08

Nobbie wrote:
lse123 wrote:can you provide a file structure with full pathname? full pathname from where?

C:\xampp\htdocs\siteY\index.php how access from here db.php?
C:\xampp\db.php


Example:

In C:/xampp/htdocs/siteY/index.php you can include db.php:

Code: Select all
<?php

include "C:/xampp/db.php";
...
?>

ACK. However, you could even use a relative file path:
Code: Select all
<?php

include 
"..\..\db.php";
...
?>
User avatar
cmb69
 
Posts: 22
Joined: 18. October 2012 03:09
Location: Germany
Operating System: Windows 7 Home Premium

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Nobbie » 13. March 2015 13:07

cmb69 wrote:ACK. However, you could even use a relative file path:
Code: Select all
<?php

include 
"..\..\db.php";
...
?>


I dont like that and had lots of problems with Xitami (another webserver), due to the problem that Xitamit does not address relatively to DocumentRoot (as Apache does), but to ServerRoot. It is safe to preceed a Server Variable (for example $_SERVER['DocumentRoot']) for the included path.
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04

Re: access with PHP a sensitive passwords files, eg db.php,

Postby lse123 » 13. March 2015 18:30

What server var gives path from root to my web site folder? in XAMPP and in LAMPP CENT OS 6 product server?
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Altrea » 13. March 2015 21:01

best approach i think is the following:
Code: Select all
include __DIR__ . '/../../db.php';
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8286
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: access with PHP a sensitive passwords files, eg db.php,

Postby lse123 » 14. March 2015 18:10

what the
__DIR__
gives?
what about:
$dir = dirname(__FILE__);
???
Leonidas Euripide Savvides
lse123
 
Posts: 143
Joined: 15. November 2008 13:49
Location: Polis, Paphos
Operating System: vista 64 ultimate

Re: access with PHP a sensitive passwords files, eg db.php,

Postby Nobbie » 14. March 2015 22:38

lse123 wrote:what about:
$dir = dirname(__FILE__);
???


What about Google???
Nobbie
 
Posts: 8759
Joined: 09. March 2008 13:04


Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests