wh33t Posted July 22, 2006 Share Posted July 22, 2006 Hey there, I'm sure this has been asked a few times but I cant for the life of me figure out what the problem would be called exactly.I got php running on apache, and I see now that when i do something likerequire('/inc/file.php'); my script no longer finds the file. It seems to think that the / means c:\ ... is there a way to tell Apache to work like linux? lol. Any push in the right direction would be great. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/ Share on other sites More sharing options...
wh33t Posted July 22, 2006 Author Share Posted July 22, 2006 Ps.I dont want to have to put $_SERVER['DOCUMENT_ROOT'] everytime i wanna do an include. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-61993 Share on other sites More sharing options...
wildteen88 Posted July 22, 2006 Share Posted July 22, 2006 Use ./ rather than /./ tells PHP to use the current working directory. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62026 Share on other sites More sharing options...
wh33t Posted July 22, 2006 Author Share Posted July 22, 2006 Ummm, that doesn't work either. I'm trying to make it so I can reference the webroot by just using / like I could on a linux box. Is this not possible? Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62122 Share on other sites More sharing options...
wildteen88 Posted July 22, 2006 Share Posted July 22, 2006 I dont think so. I havn't seen this done. Just use relative paths. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62131 Share on other sites More sharing options...
wh33t Posted July 22, 2006 Author Share Posted July 22, 2006 but if I include a file that includes a file relative paths dont work cause they are all relative to the file thats including them in the first place. :( Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62136 Share on other sites More sharing options...
wildteen88 Posted July 22, 2006 Share Posted July 22, 2006 This is where $_SERVER['DOCUMENT_ROOT'] comes in, if you dont want to type out $_SERVER['DOCUMENT_ROOT'] all the time then you can do this: $dr = $_SERVER['DOCUMENT_ROOT'];then use $dr to referent the document root. like so:include $dr . '/inc/file.php'; Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62139 Share on other sites More sharing options...
wh33t Posted July 22, 2006 Author Share Posted July 22, 2006 ahh. well thats what I figured I was gonna have to do unless there was some sort of command directive i could toss into apache.Ok well. if I do the documentroot thing it will run fine when i move it to the linux webspace right? Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62143 Share on other sites More sharing options...
wildteen88 Posted July 22, 2006 Share Posted July 22, 2006 Yeah it should do as $_SERVER['DOCUMENT_ROOT'] is set with the servers document root. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62146 Share on other sites More sharing options...
wh33t Posted July 22, 2006 Author Share Posted July 22, 2006 thanks man :) appreciate that. Quote Link to comment https://forums.phpfreaks.com/topic/15319-windows-and-absolute-paths/#findComment-62153 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.