kevineugenius Posted October 10, 2007 Share Posted October 10, 2007 So, we had a professional guy build a website for us a number of years ago, but updating the site with our provided info took a while and was fairly costly. I got the ftp info and have been able to update the site fairly well for much cheaper since then. Now, though, I'm trying to add new features and perhaps even change some of the more complex things that are on the site, and I really don't know much about it. So, I've undertaken learning PHP. I don't even know much HTML, so it will definately be interesting. On my third attempt to get some sort of web server working (the second attempt might have worked, but I made a noob mistake and then uninstalled it all), I have gotten WAMP up on my Windows Vista machine. Everything is pretty much the latest version. I then downloaded all of the files off of my website and put them into the localhost directory. The http://localhost/home.php link works, but none of the php code on the site works. On home.php, there are two includes and a little program that determines if we are open or not, nothing real special. Except none of the codes work. So, I made a test.php and an includeme.php and those work fine. Then I re-coded one of the includes on home.php and got it to work. So, my question is this: what is the difference between the two codes below? Not working on my localhost, works online: <? $page = "home.php"; include $_SERVER["DOCUMENT_ROOT"] . "/include/header.php"; ?> Working on my localhost, not tested online: <?php include('include/header.php'); ?> I'm sure he/they had a good reason for the way they did it, and I'm sure the whole $_server/documentroot garble has some sort of importance, but I sure don't know what it is. I just don't like to go in and change things without knowing what I'm doing. Quote Link to comment https://forums.phpfreaks.com/topic/72683-solved-codes-work-online-but-not-on-my-localhost-wamp/ Share on other sites More sharing options...
marcus Posted October 10, 2007 Share Posted October 10, 2007 echo $_SERVER['DOCUMENT_ROOT']; Quote Link to comment https://forums.phpfreaks.com/topic/72683-solved-codes-work-online-but-not-on-my-localhost-wamp/#findComment-366488 Share on other sites More sharing options...
kevineugenius Posted October 10, 2007 Author Share Posted October 10, 2007 Alright, good idea. Now, with the folder tree that gave me, is there some way I can plug that into apache to make it properly emulate my site, or do I need to setup the folder tree in my localhost directory? Quote Link to comment https://forums.phpfreaks.com/topic/72683-solved-codes-work-online-but-not-on-my-localhost-wamp/#findComment-366497 Share on other sites More sharing options...
marcus Posted October 10, 2007 Share Posted October 10, 2007 $folder = "c:\folderofyourfiles\"; include $folder . "images\lol.gif"; Quote Link to comment https://forums.phpfreaks.com/topic/72683-solved-codes-work-online-but-not-on-my-localhost-wamp/#findComment-366499 Share on other sites More sharing options...
kevineugenius Posted October 10, 2007 Author Share Posted October 10, 2007 I don't follow. What am I supposed to do with that? I've been learning PHP for about 3 hours... I recognize 'echo' but I don't know what the second thing you put up there is going to do. EDIT: I think I'm starting to figure out at least what the commands are doing, but I don't know how I can make apache emulate it so it works without me having to edit every single file to point it to the correct path... Quote Link to comment https://forums.phpfreaks.com/topic/72683-solved-codes-work-online-but-not-on-my-localhost-wamp/#findComment-366500 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.