Home

News

Forums

Hardware

CPUs

Motherboards

Video

Guides

CPU Prices

RAM Prices


Sharky Extreme : Forums:


+ Reply to Thread
Results 1 to 9 of 9

Thread: PHP problem

  1. #1
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    13

    Post PHP problem

    I'm a beginner in PHP, and I've tried to make some code by myself. I've stubled across this problem I can't seem to solve.

    When I use the line <? include("/cgi-bin/banner.cgi"); ?> I get an error msg.
    Warning: Failed opening '/cgi-bin/banner.cgi' for inclusion (include_path='./:/usr/local/lib/php') in /home/outerfx/outerfx-www/banner.php on line 1

    It seems as if the PHP thingie doesn't know how to read from root with /. How do I define this, so that it will be correct?

    To use /cgi-bin in HTML works fine, why?

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Where exactly is your cgi-bin in relation to the banner.php document?

    Lemme guess...
    cgi-bin is here:
    /home/outerfx/cgi-bin
    and as it showed in your code, banner.php is here:
    /home/outerfx/outerfx-www/banner.php

    So...here's how I would include "banner.cgi"

    <? include("../cgi-bin/banner.cgi"); ?>


    Should work...I *think*

  3. #3
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    13

    Post

    Yes, that would work if the file I put <?include("../cgi-bin/banner.cgi"); ?> in, is in /home/outerfx/outerfx_www, but I'm using header and footer files for the layout, and all the files retrieve from them, so therefore if the file is in f.ex. /home/outerfx/outerfx_www/things it won't work.

    Shouldn't there be a way to specify the include_path variable or something?

    [This message has been edited by Trophy (edited January 26, 2001).]

    [This message has been edited by Trophy (edited January 26, 2001).]

  4. #4
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Hmmmmm, I've flipped through my book and can't seem to find an include command that starts itself at the rootweb. I know that this is easily done in SSI, but we're lookin' at PHP here....and I'm stumped. I'm *sure* there's a way to do it in PHP, but my limited knowledge of the language prevents me from seeing it. Sorry buddy, and good luck.

  5. #5
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    13

    Post

    Well, well... we're at the point where we really need more programmers in here, again...

    I guess I'll have to find out a way to get around this problem, though I doubt I'll get any way with it.

    Know anywhere else I could look or ask?

  6. #6
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    13

    Cool

    It wasn't really a big problem.
    All I had to do was include the whole root path.

    So instead of just /cgi-bin/banner.cgi it would be /home/outerfx/outerfx-www/cgi-bin/banner.cgi

    Thanks anyways.

  7. #7
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Well....how in the world does the PHP script know weither to interpret the include as a relative link, or an absolute link? I've only used them with relative links...so naturally I assumed that that's how they worked.

  8. #8
    Reef Shark Pestilence's Avatar
    Join Date
    Dec 2000
    Location
    Hickville, USA. :(
    Posts
    353

    Post

    Originally posted by Grizzly:
    Well....how in the world does the PHP script know weither to interpret the include as a relative link, or an absolute link? I've only used them with relative links...so naturally I assumed that that's how they worked.
    Well with absolute linking at least on the server side couldn't you just give the location right from the c:/ to the file?

    ------------------
    Kill em all and let God sort'em out.

    WoU
    Orc, 6.3k acres
    God damnit, better graphics != revolutionary gaming! Get it through your skull!

  9. #9
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Yeah that could be an idea, lol, didn't think of that!

    But what confused me is you said this worked:
    /home/outerfx/outerfx-www/cgi-bin/banner.cgi

    Now...if you php page was in the outerfx-www directory....than wouldn't it be looking for the file in

    /home/outerfx/outerfx-www//home/outerfx/outerfx-www/cgi-bin/banner.cgi

    ??

    Cause really....looking at that alone, the PHP interpreter has no idea if your intentions are relative or absolute.....or does it?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts