including files in other directories

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ebobnar

    including files in other directories

    I have some code running on windows on my local machine that uses the
    jpgraph image library. I include the jpgraph libs using

    include ("C:\Programmin g\php\jpgraph-1.14\src\jpgrap h.php");

    I am trying to get this code to run on my web host's unix server, with
    no luck.
    I put the folder (jpgraph) containing all the jpgraph libs in the same
    directory as my php code. I have tried all of the following:

    include ("/jpgraph/jpgraph-1.14/src/jpgraph.php"); //(relative
    path)

    include ("jpgraph/jpgraph-1.14/src/jpgraph.php"); //(relative
    path without leading slash)

    include ("/usr/www/users/mysite/jpgraph/jpgraph-1.14/src/jpgraph.php");
    //(absolute path)

    include("http://www.mysite.com/jpgraph/jpgraph1.14/src/jpgraph.php");
    //(url)

    include ("http://" . $_SERVER['HTTP_HOST']
    . "/" . dirname($_SERVE R['PHP_SELF'])
    . "/" . "jpgraph/jpgraph-1.14/src/jpgraph.php");

    None of these have worked. Does anyone know the proper technique to
    include files in other directories when using Unix or Linux? Keeping
    all php files in the same directory is not feasible.

    Thanks,

    Esoos
  • Tim Tyler

    #2
    Re: including files in other directories

    ebobnar <ebobnar74@yaho o.com> wrote or quoted:
    [color=blue]
    > include ("jpgraph/jpgraph-1.14/src/jpgraph.php"); //(relative
    > path without leading slash)[/color]

    That should normally work.
    --
    __________
    |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.

    Comment

    • Shawn Wilson

      #3
      Re: including files in other directories

      ebobnar wrote:[color=blue]
      >
      > I have some code running on windows on my local machine that uses the
      > jpgraph image library. I include the jpgraph libs using
      >
      > include ("C:\Programmin g\php\jpgraph-1.14\src\jpgrap h.php");
      >
      > I am trying to get this code to run on my web host's unix server, with
      > no luck.
      > I put the folder (jpgraph) containing all the jpgraph libs in the same
      > directory as my php code. I have tried all of the following:[/color]

      [color=blue]
      > include ("jpgraph/jpgraph-1.14/src/jpgraph.php"); //(relative
      > path without leading slash)[/color]

      This should work (or the absolute path). You also have to make sure the owner
      of the PHP files have permission to access the directory and the libraries.
      What are the permissions set to on the directory and files? What error are you
      getting? --> error_reporting (E_ALL)

      Shawn
      --
      Shawn Wilson
      shawn@glassgian t.com

      Comment

      Working...