The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

including a php file gives me an error. Not when include() t

Discussion in 'General Discussion' started by Domenico, Mar 26, 2002.

  1. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    362
    Likes Received:
    0
    Trophy Points:
    16
    Hi all!

    When I try to include a php file like this:
    &?
    require &file.php&;
    ?&
    I get this error:
    Fatal error: Failed opening required file.php'
    (include_path='.:/usr/share/php') in /home/test/public_html/file.php on line 1


    But when I do it like this:
    &?
    require &http://mydomain.com/file.php&;
    ?&
    it works!

    Why is this? I can't figure out why because on some clients it does work both ways.
    What is configured wrong here?

    Thank you,
    Domenico
     
  2. kosmo

    kosmo Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    403
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    All over Europe
    You may haven't defined &.& as include path. PHP willl only search in the local dir if it is defined as &include& path. If you can't access your php.ini then you can modify the .htaccess file of the dir where your php files exist. Add this line:

    php_value include_path &/path/to/here&

    kosmo
     
  3. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    362
    Likes Received:
    0
    Trophy Points:
    16
    I have access to php.ini but this is a server with more clients and they use php too.

    Another client that uses include and/or require has no problem and it works great.
     
  4. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    362
    Likes Received:
    0
    Trophy Points:
    16
    Let me rephrase my problem because I forgot to mention something.

    What I want to use but doesn't work is:
    &?
    require &file.php?show=10&;
    ?&

    This works now:
    &?
    require &file.php&;
    ?&

    So why is this then?
     
  5. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    362
    Likes Received:
    0
    Trophy Points:
    16
    &?
    $show=10;
    require &file.php&;
    ?&


    This works!
    Too bad the manual didn't mention this :(
     
Loading...

Share This Page