Filip2 Posted July 23, 2021 Share Posted July 23, 2021 I just installed XAMP on my windws pc. When I try to launch my index.html file, I only get this output: Hello World";?> This is not correct... My index.html file consists thrse lines: <html> <head> <title>PHP Test</title> </head> <body> <?php echo "<p>Hello World</p>";?> </body> </html> What is wrong? Thanks in advance... Quote Link to comment https://forums.phpfreaks.com/topic/313419-php-not-installed-correctly/ Share on other sites More sharing options...
Solution Barand Posted July 23, 2021 Solution Share Posted July 23, 2021 1 hour ago, Filip2 said: What is wrong? Your file name is index.html and not index.php. You need a php file for php code to be executed. 1 Quote Link to comment https://forums.phpfreaks.com/topic/313419-php-not-installed-correctly/#findComment-1588525 Share on other sites More sharing options...
kicken Posted July 23, 2021 Share Posted July 23, 2021 Your file should be named with a .php extension, not .html. You need to load the file via the web server, not by just double-clicking on it to open it in windows. Open your browser and load the url http://localhost/index.php 1 Quote Link to comment https://forums.phpfreaks.com/topic/313419-php-not-installed-correctly/#findComment-1588526 Share on other sites More sharing options...
Filip2 Posted July 24, 2021 Author Share Posted July 24, 2021 Thanks for the solutions. Indeed, the php-code must be in a .php file. It works. What I don't understand is that I find examples on the internet wih php code included in .html files. Quote Link to comment https://forums.phpfreaks.com/topic/313419-php-not-installed-correctly/#findComment-1588551 Share on other sites More sharing options...
mac_gyver Posted July 24, 2021 Share Posted July 24, 2021 4 minutes ago, Filip2 said: What I don't understand is that I find examples on the internet wih php code included in .html files. you CAN configure the web server to treat .html (or any other extension) as a php file. the default is for only the .php extension. 1 Quote Link to comment https://forums.phpfreaks.com/topic/313419-php-not-installed-correctly/#findComment-1588552 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.