Re: include, relative path



On 2008-04-30, ^AndreA^ <andrea.bola@xxxxxxxxx> 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...


did you try

include ("/mysite/libraries/db_details.php");

if using Linux, get the full path by going to the commandline and

echo $PATH

/home/mywebsite/myhtml etc etc.

Don't forget the first forward slash.

ken



.



Relevant Pages

  • [PATCH 19-rc2] Fix misc .c/.h comment typos
    ... Implements an interface for i2c compatible eeproms to run under linux. ... Changed struct initializer syntax to the currently preferred notation ... ** Packet is an actual packet structure to be filled in with the packet ... -** as the command processore doesn't process the command packet in any way. ...
    (Linux-Kernel)
  • Re: Problem with Java launching aTunes.
    ... I strongly recommend that you log on to the web site for your Linux distro and read all their HOW-TO documents. ... If you are using the bash shell, as most Linux command line processors do, you can enter the command "man bash" which yields not a treatise by Betty Friedan, but a rather comprehensive manual on the "bash" shell. ... Short version: use the "echo" command. ...
    (comp.lang.java.help)
  • Re: [opensuse] deleting
    ... during the installation of jre 1.5.0 (according to the install ... i'm learning and having fun with my new toy, the command line interface. ... understand and use linux more efficiently. ... /bin/sh is the Bourne Shell. ...
    (SuSE)
  • Re: how i will open (from Java Application) the MS word format /html documentsin repective Applicati
    ... documentsin repective Applications in Linux OS? ... What I did in the Linux version of our product was require an external ... I create a URI object around it and use that. ... array by separating the CDE command line at the spaces, ...
    (comp.lang.java.programmer)
  • Re: VERY basic linux system
    ... "> I keep hearing that you can modify linux to your liking, ... 'user', but once you have a multi-tasking kernel, multi-user is pretty ... Command names are arbitary and virtually all command shells allow all ... supporting stuff, and stuff supporting the support stuff, etc. ...
    (comp.os.linux.misc)