Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.