php include file using document root

Status
Not open for further replies.

funkymunky20079

New Member
Messages
3
Reaction score
0
Points
0
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
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Where exactly is the file you are including located?
 

funkymunky20079

New Member
Messages
3
Reaction score
0
Points
0
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!
 

stpvoice

Community Support Rep
Community Support
Messages
5,987
Reaction score
212
Points
63
Issue resolved; closed.
 
Status
Not open for further replies.
Top