Re: include, relative path
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 07:48:20 -0400
^AndreA^ wrote:
Hi everybody,
I'm having a stupid problem with the include command.
I looked around and I found some solutions but, I don't know why, they
don't work at all.
Briefly, this is the structure of my website:
mysite/libraries/db_details.php
mysite/registration/check.php
I need to connect to the database from the script "check.php", and the
details of the database are in "db_details.php", of course... ;-)
so, I have to include "db_details.php" from "check.php" script...
I'm under linux and I've tried so many different solutions without
success, maybe because of the PHP version (5.2.3)... and some
solutions I found were a bit old (2002, 2003) and so I thougth they
could not to work any more.
Here some of them,
ini_set("include_path",".:/libraries");
set_include_path('mysite/libraries/');
include('/..//libraries/db_details.php');
include("../registration/db_details.php");
include "db_details.php";
I'm fed up with that...
any help would very appreciated!!!
Thanks in advance
PS: I don't want to change php.ini settings because I couldn't do it
on my hosting server...
Use $_SERVER['DOCUMENT_ROOT'] to get to the root directory of your website, then reference from there, i.e.
include ($_SERVER['DOCUMENT_ROOT'] . '/libraries/db_details.php');
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- include, relative path
- From: ^AndreA^
- include, relative path
- Prev by Date: Re: Any idea how to do it right?
- Next by Date: Re: I've been hacked, help!
- Previous by thread: include, relative path
- Next by thread: Re: include, relative path
- Index(es):
Relevant Pages
|