Jump to content

Relative Path Help


pureplayer

Recommended Posts

Hi, I don't know much about PHP but I have this include thats giving me trouble.
<? include("home/www/url.com/dynamicpoll/poll.php"); ?>

the "/url.com/" section is my domain name i'm using on a free webserver and my files are locted in there. I think this part is giving me errors.

any help will be appreciated

thanks 
Link to comment
https://forums.phpfreaks.com/topic/33633-relative-path-help/
Share on other sites

unless you're in the very root of the server, then 'home/www/url.com/dynamicpoll/poll.php' will try and first find a directory called 'home' in the CURRENT directory.
try a prepending slash:

<? include("[b]/[/b]home/www/url.com/dynamicpoll/poll.php"); ?>

failing that, try this

[code]
<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>
[/code]
and see how much of the full path it provides. then just append the rest to it, such as:

[code]
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/dynamicpoll/poll.php');
?>
[/code]

hope that helps
Link to comment
https://forums.phpfreaks.com/topic/33633-relative-path-help/#findComment-157585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.