Problem with require() and script under public_html

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • acrux14@hotmail.com

    #1

    Problem with require() and script under public_html

    Hi,

    I'm trying to include PEAR's Net_IPv4 module in a web PHP script I'm
    coding. Using PHP v4.4.0.

    Other scripts on this web server (not personal user scripts, but main
    site ones) call it with:

    require_once("N et/IPv4.php");

    and it works.

    My script is under my public_html directory and if I use that same line
    I get a "Fatal error: Call to undefined function: validateip() in
    /home/james/public_html/test/srt/srt-0_3.php on line 258".

    I thought that maybe PHP safe mode was on (theoretically it's not, but
    since I don't own that IPv4.php file...), so I placed my own copy of
    IPv4.php in my own public_html, then in the same dir as the script,
    then under Net directories in each of the two previous ones, always
    with the same error message.

    This server's include path is set to:

    include_path = ".:/usr/lib/php"

    According to my interpretation of the documentation, if I use
    "require_once(" ./IPv4.php");" and include IPv4.php in the script's same
    directory it should work... what am I missing here?

    Thanks for your help! :-)

    James

  • philipscanlan@gmail.com

    #2
    Re: Problem with require() and script under public_html

    Maybe this would work...

    require_once("{ $_SERVER['DOCUMENT_ROOT']}/Net/IPv4.php");

    acrux14@hotmail .com wrote:[color=blue]
    > Hi,
    >
    > I'm trying to include PEAR's Net_IPv4 module in a web PHP script I'm
    > coding. Using PHP v4.4.0.
    >
    > Other scripts on this web server (not personal user scripts, but main
    > site ones) call it with:
    >
    > require_once("N et/IPv4.php");
    >
    > and it works.
    >
    > My script is under my public_html directory and if I use that same line
    > I get a "Fatal error: Call to undefined function: validateip() in
    > /home/james/public_html/test/srt/srt-0_3.php on line 258".
    >
    > I thought that maybe PHP safe mode was on (theoretically it's not, but
    > since I don't own that IPv4.php file...), so I placed my own copy of
    > IPv4.php in my own public_html, then in the same dir as the script,
    > then under Net directories in each of the two previous ones, always
    > with the same error message.
    >
    > This server's include path is set to:
    >
    > include_path = ".:/usr/lib/php"
    >
    > According to my interpretation of the documentation, if I use
    > "require_once(" ./IPv4.php");" and include IPv4.php in the script's same
    > directory it should work... what am I missing here?
    >
    > Thanks for your help! :-)
    >
    > James[/color]

    Comment

    • acrux14@hotmail.com

      #3
      Re: Problem with require() and script under public_html

      Ok... that did not make it, but thanks for pitching in, Philip.

      I finally found what I was doing wrong... I was supposed to call the
      function as Net_IPv4::funct ionname() instead of using just
      functionname(). I'm not sure if that is because of some config on this
      server or if always has to be done that way...

      If somebody is willing to enlighten me, I'll appreciate it.

      But hey... it works now! ;-)

      James

      Comment

      Working...