Closed Thread
Results 1 to 4 of 4

Thread: php include file using document root

  1. #1
    funkymunky20079 is offline x10Hosting Member funkymunky20079 is an unknown quantity at this point
    Join Date
    Jun 2011
    Posts
    3

    php include file using document root

    Hi,

    I'm trying to include a file using php using the document root ($DOCUMENT_ROOT) method and I'm receiving the following error:

    Warning: include_once(/home/adam1234/public_html/resources/libraries/facebook/fbmain.php) [function.include-once]: failed to open stream: No such file or directory in /home/adam1234/public_html/index.php on line 3

    Warning: include_once() [function.include]: Failed opening '/home/adam1234/public_html/resources/libraries/facebook/fbmain.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/adam1234/public_html/index.php on line 3


    I have also tried using a preceding backslash [the php is: include_once('/resources/config.php') ] however this returns the following error:

    Warning: require_once(/resources/config.php) [function.require-once]: failed to open stream: No such file or directory in /home/adam1234/public_html/index.php on line 2

    Fatal error: require_once() [function.require]: Failed opening required '/resources/config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/adam1234/public_html/index.php on line 2


    The only way I can seem to get includes to work is using relative paths which will prove impractical as I continue to develop the site to a large scale.

    Is there anyway I get get root path includes to work? I tried looking in phpinfo() however it has been disabled.

    Many thanks,
    Adam Bedford

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: php include file using document root

    Where exactly is the file you are including located?
    Nothing is always absolutely so.

  3. #3
    funkymunky20079 is offline x10Hosting Member funkymunky20079 is an unknown quantity at this point
    Join Date
    Jun 2011
    Posts
    3

    Re: php include file using document root

    Hi,

    Thanks for your reply. I have actually sorted the issue now, it seems that I was confusing myself by having similarly named files in different folders and so there wasnt actually a PHP error, just a human one!

    Thanks for the help!

  4. #4
    stpvoice's Avatar
    stpvoice is offline Community Support Rep stpvoice has a brilliant futurestpvoice has a brilliant futurestpvoice has a brilliant future
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    5,939

    Re: php include file using document root

    Issue resolved; closed.


Closed Thread

Similar Threads

  1. php include - above root directory
    By tillabong in forum Programming Help
    Replies: 27
    Last Post: 01-17-2010, 07:07 PM
  2. Creating Your Error Document File
    By Rotunno98 in forum Computers & Technology
    Replies: 3
    Last Post: 07-24-2009, 09:54 AM
  3. Parked Domain Document Root
    By xeross in forum Free Hosting
    Replies: 0
    Last Post: 06-06-2008, 03:38 AM
  4. Document root
    By thezone1 in forum Free Hosting
    Replies: 8
    Last Post: 03-18-2008, 10:31 AM
  5. Replies: 1
    Last Post: 11-09-2007, 05:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers