Re: Problems including a file referenced from SERVER['DOCUMENT_ROOT']



monomaniac21 wrote:
Rik wrote:
monomaniac21 wrote:
Why does this find the file:

<img
src="<?=$_SERVER['DOCUMENT_ROOT']?>/images/viessmann_header_logo.gif">

But this does not?

$right_content =
$_SERVER['DOCUMENT_ROOT']."includes/content/content.php";

include $right_content;

Perhaps:
$_SERVER['DOCUMENT_ROOT']."/includes/content/content.php";


(topposting fixed)

sorry that was typo document root contains the a forward slash

Well then:
ini_set('display_errors',1);
error_reporting(E_ALL);
$right_content = $_SERVER['DOCUMENT_ROOT']."includes/content/content.php";
include($right_content) or die ("File $right_content not found");

And check wether you really can find it in that particular dir manually...

Micheal Fesser also makes a good point:
<img src="<?=$_SERVER['DOCUMENT_ROOT']?>/images/viessmann_header_logo.gif">

Should not work, or only locally, as you document root is not visible to
others, only to yourself. It should fail on every computer except your own,
unless indeed $_SERVER['DOCUMENT_ROOT'] is not set.
--
Rik Wasmus


.



Relevant Pages

  • Re: PHP Blank Page.
    ... > Wether there's a parse error in your other includes I couldn't say. ... > echo it to check wether the result has data or is empty, ... > Rik Wasmus ... I removed the header file and now it doesn't report anything. ...
    (comp.lang.php)
  • Re: Sessions not working in windows vista
    ... I am trying to pass value from a page to another page through session ... Check wether there's a file created in session.save_path, and possible user write permissions for this path. ... Rik Wasmus ...
    (comp.lang.php)
  • Re: regular expression problem (preg_replace)
    ... monomaniac21 wrote: ... No need for the /s modifier offcourse... ... Rik Wasmus ... string but i also need it to strip out any i's that ...
    (comp.lang.php)