Forum Moderators: coopster
i have no success reading a file by pointing to its location via
$path = $_SERVER['DOCUMENT_ROOT']."filedir";
but
$path = "http://localhost\\filedir"; (in a local enviroment)
works.
I have some lack in understanding and therefore i'm wondering myself how can i access a file server sided by using the absolute path to its location?
thanks.
And Welcome to WebamsterWorld! :)
1) Are you getting any errors when you try to use the path?
Actually, i'm storing the path to a .swf file in a variable. In a embedded flash object i set the src of the movie to that path.
If i set the path with $_SERVER['DOCUMENT_ROOT'], the .swf is not found, although the path i echo from $_SERVER['DOCUMENT_ROOT'] is correct. BTW, when i enter the path by hand, the flash file does not load either.
But if i use a relative path like ./filedir or the "h t t p://localhost..." path, the .swf loads.
Besides that, i do not get any errors.
<?php
print '<pre>';
print_r($_SERVER);
print '</pre>';
?>
... on a side note, there is a similar discussion running right now ...
[webmasterworld.com...]
and
<?PHP include($_PATH1.'en-US/footer/'."footer_si.php");?>
They actually do not work any more.
If I go directly to this path (echo path), it will work file.
So, I think this is issue on server side when upgraded.
Is this correct?
You just need to figure out which one you need, for example, an embed link to a .swf should be the HTTP_HOST based link - but a php include should be based on DOCUMENT_ROOT
Is print "http://$_SERVER[HTTP_HOST]/"; the same as my code:
$_PATH1 ="http://" . $_SERVER['HTTP_HOST']."/";
upgraded to Apache version 2.0.63. and also to PHP version 5.2.6
Strange that on new server this path does not work anymore.
Do you have any idea which index variable should be additional checked?
Old server showed me:
[REQUEST_URI] => /index.php
[SCRIPT_NAME] => /index.php
What will influence this variable? Need help.
I had in old server:$_PATH1 ="http://" . $_SERVER['HTTP_HOST']."/";
Now it does not work anymore path.