Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    371
    Likes Received:
    1
    Trophy Points:
    316
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. kosmo

    kosmo Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    403
    Likes Received:
    0
    Trophy Points:
    316
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    316
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    316
    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?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    371
    Likes Received:
    1
    Trophy Points:
    316
    &?
    $show=10;
    require &file.php&;
    ?&


    This works!
    Too bad the manual didn't mention this :(
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice