jobs Posted April 2, 2009 Share Posted April 2, 2009 I'm trying to figure out how to resolve an issue with paths. On my development computer, I load my home page like this: http://localhost/hhs/index.php On my server, I don't use the "localhost/hhs, so on the server the files are located up one folder in the tree. In development, I can access a file by "hhs/lib/myfile.php" but on the server this does not work. It must be changed to "lib/myfile.php" I have tried what seems to be every combination of $_SERVER[HTTP_HOST] and __FILE__, but nothing is working. Please help! Quote Link to comment https://forums.phpfreaks.com/topic/152280-solved-resolving-local-host-path-and-domain-path/ Share on other sites More sharing options...
MadTechie Posted April 2, 2009 Share Posted April 2, 2009 when you access the files use the path in relations to where the current file is, to find the path of the current file do dirname(__FILE__)."/" Quote Link to comment https://forums.phpfreaks.com/topic/152280-solved-resolving-local-host-path-and-domain-path/#findComment-799708 Share on other sites More sharing options...
jobs Posted April 3, 2009 Author Share Posted April 3, 2009 this works.. <link rel="stylesheet" type="text/css" href=" <?php echo 'lib/css/site.css'; ?>" media="all" /> This will not work... <link rel="stylesheet" type="text/css" href="<?php echo $myRoot.'lib/css/site.css' ; ?>" media="all" /> I have tried defining $myRoot as DOCUMENT_ROOT, HTTP_HOST, dirname(__FILE___) but none will load css file. Any ideas? THanks. Seems like this would be any easy task to accomplish. Quote Link to comment https://forums.phpfreaks.com/topic/152280-solved-resolving-local-host-path-and-domain-path/#findComment-800521 Share on other sites More sharing options...
MadTechie Posted April 3, 2009 Share Posted April 3, 2009 because thats being called from the web page not php! if you have $webRoot = "http://blar.com/tester/" then change that depending the pc your developing on it should be fine! Quote Link to comment https://forums.phpfreaks.com/topic/152280-solved-resolving-local-host-path-and-domain-path/#findComment-800572 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.