Leng Posted September 26, 2010 Share Posted September 26, 2010 This is my website: www.wearenip.com/home.html This is the menu that should appear on the left hand side, but doesn't: www.wearenip.com/menu.php This is my server's output saying that php is running just fine: http://wearenip.com/phpinfo.php I'm using this code in the left side bar div: <?php include("menu.php"); ?> The PHP file will not display from the HTML file no matter what I do. I've tried using every possible combination of file linking including /menu.php ./menu.php and even the full http://www.wearenip.com/menu.php etc etc etc I'm genuinely upset about this. Any help would be greatly appreciated. PS: I can't get any PHP file to properly include in any HTML file on any computer I have. Nothing displays whatsoever regardless of what is in the PHP file, even if it's just a text word. Doesn't matter if it's hosted on a PHP compatible internet server or just on a local server or just on the local machine itself. Nothing. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/ Share on other sites More sharing options...
coupe-r Posted September 26, 2010 Share Posted September 26, 2010 What if you rename your index.html to index.php? Then see if your menu shows up? Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116064 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 I've tried renaming the file home.php, I've tried making a NEW php file from scratch, making a NEW php file from DreamWeaver, I've tried everything on multiple computers and multiple servers and different kinds (Apache, etc) and can not get a single instance of <?php include("menu.php"); ?> to work at all, period. Has anyone else ever got this to work? Every single website says this is all you have to do is include this one line of code in your HTML. I've tried using 'menu.php', "www.wearenip.com/menu.php", 'www.wearenip.com/menu.php', literally HUNDREDS of combinations of computers, servers, browsers, etc. I'm banging my head against the wall. I can't get a single PHP script to run, even if it's as simple as ECHO'ing hello world. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116067 Share on other sites More sharing options...
Pikachu2000 Posted September 26, 2010 Share Posted September 26, 2010 That's exactly the problem. If you do a View Source, you'll see your <?php include . . . ?> in the page's html source. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116068 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 Look, all you have to do is go to: www.wearenip.com/home.html and click on "View page source" in your browser. Look and see it even pinks out the one PHP line of code: wtf? That should have my menu in HTML form, not a pinked-out or greyed-out PHP code. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116069 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 That's exactly what I'm saying. PHP should replace that line with the menu.php file located here: www.wearenip.com/menu.php Why is that not happening? Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116070 Share on other sites More sharing options...
Pikachu2000 Posted September 26, 2010 Share Posted September 26, 2010 Because any php code in an html file will not be interpreted/parsed unless the file has a .php extension, or the .html file extension has been added to the types of files that the php interpreter should parse. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116071 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 But I've changed the names of all the files to end in .php instead of .html and the exact same thing happened, even when I refreshed the entire server and reloaded all the files (so they're only php) and refreshed on multiple browsers. (D'oh, changing to php works when I allow the server to actually update.) Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116072 Share on other sites More sharing options...
Pikachu2000 Posted September 26, 2010 Share Posted September 26, 2010 That's exactly what I'm saying. PHP should replace that line with the menu.php file located here: www.wearenip.com/menu.php Why is that not happening? Thank you for your help. PHP should not replace that line with anything unless it is contained within a file that the PHP interpreter has been specifically instructed to parse, such as those with a .php file extension. That file currently has a .html extension, thus it is being ignored. EDIT: Create a copy of the home.html file, and save the copy with a .php extension. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116075 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 You are right Pikachu, I thought the server was properly configured to parse HTML files but it appears as if it wasn't. I'll have to get my server admin to help me out with that. Thanks a ton for figuring this out for me. Much obliged!! Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116076 Share on other sites More sharing options...
coupe-r Posted September 26, 2010 Share Posted September 26, 2010 Hey Hey Hey, don't forget me!!! Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116077 Share on other sites More sharing options...
Leng Posted September 26, 2010 Author Share Posted September 26, 2010 Whoops, sorry coupe-r! Your solution was also correct, the only reason it didn't work when I tried it is because I didn't properly refresh the server. *blushes* Thanks a ton for helping me out. I really thought this server's PHP was configured to parse HTML files You guys rock! Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116078 Share on other sites More sharing options...
coupe-r Posted September 26, 2010 Share Posted September 26, 2010 Only kidding. Glad it worked out. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116080 Share on other sites More sharing options...
Pikachu2000 Posted September 26, 2010 Share Posted September 26, 2010 You're welcome. You don't need to have anything reconfigured if you don't want to. You can simply save any file with PHP code in it with a .php extension, and it will be fine. Just remember to edit any references (such as include()s ) to reflect the .php extension. Link to comment https://forums.phpfreaks.com/topic/214479-very-very-simple-problem/#findComment-1116082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.