visualazza Posted August 14, 2010 Share Posted August 14, 2010 hey, i have been trying all day to get something to work that will allow me to replicate the / part of an href <a href="/images/blah.jpg"> to go from the root folder in php. i thought the easiest way to do this is to use php to get the domain address. require($_SERVER['SERVER_NAME']."/header.php"); i have gotten to this part but am still getting the error that the file doesnt exist probably because there is no http:// in front of it but i do not want to turn allow_url_includes on in the php.ini file. How can i acheive this? Thanks Link to comment https://forums.phpfreaks.com/topic/210734-_serverserver_name-and-require-function/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 14, 2010 Share Posted August 14, 2010 $_SERVER['DOCUMENT_ROOT'] Link to comment https://forums.phpfreaks.com/topic/210734-_serverserver_name-and-require-function/#findComment-1099295 Share on other sites More sharing options...
visualazza Posted August 14, 2010 Author Share Posted August 14, 2010 localhost that works fine, but when i upload to my server i get the error Fatal error: require() [function.require]: Failed opening required '/header.php' (include_path='.;c:\php\5\pear') Link to comment https://forums.phpfreaks.com/topic/210734-_serverserver_name-and-require-function/#findComment-1099298 Share on other sites More sharing options...
visualazza Posted August 14, 2010 Author Share Posted August 14, 2010 ok, my server documentroot is something like //home/users/web/b1165/ez.username Link to comment https://forums.phpfreaks.com/topic/210734-_serverserver_name-and-require-function/#findComment-1099311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.