PHP returns bad HTML
Posted by: TimMiller (---.lightspeed.hstntx.sbcglobal.net)
Date: April 01, 2020 08:40PM

Windows 7 Professional
installed WAMPSERVER x64
WAMPSERVER GREEN
WampServer Version 3.2.0 64bit
Created by Romain Bourdon (2005)
Maintainer / Upgrade to 2.5 by Herve Leclerc
Upgrade to 3 by Otomatic (wampserver@otomatic.net)
Multi styles for homepage by Jojaba
Installer by Inno Setup: [www.jrsoftware.org]
Forum Wampserver: [forum.wampserver.com]
______________________ Versions used ______________________
Apache 2.4.41 Port 80- PHP 7.3.12
MySQL 8.0.18 Port 3308
MariaDB 10.4.10 Port 3306
PHP 5.6.40 for CLI (Command-Line Interface)
-----------------------------------------
**test code: from w3schools.com sample**

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<body>
<?php
echo "<h2>PHP is Fun!</h2>";
echo "Hello world!<br>";
echo "I'm about to learn PHP!<br>";
echo "This ", "string ", "was ", "made ", "with multiple parameters.";
?>
</body>
</html>
----------------------------------------------
**here is what display in browser**

PHP is Fun!"; echo "Hello world!
"; echo "I'm about to learn PHP!
"; echo "This ", "string ", "was ", "made ", "with multiple parameters."; ?>

**here is the HTML from PHP:**
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<!--?php echo "<h2-->
PHP is Fun!"; echo "Hello world!
<br>
"; echo "I'm about to learn PHP!
<br>
"; echo "This ", "string ", "was ", "made ", "with multiple parameters."; ?>
</body>
</html>

ANY IDEAS???

Options: ReplyQuote
Re: PHP returns bad HTML
Posted by: RiggsFolly (Moderator)
Date: April 01, 2020 10:58PM

Hi

You installed a web server, but you are not using the web server.

You cannot click on the file in explorer when you have PHP in the file, so if you have a url with `file:///` at the start you are doing it all wrong.


Call the file something with an extension of `.php` lets try `index.php`

Now assuming you put this code in `d:\wamp64\www\test1\index.php` then enter `localhost/test1` in the browser address bar and see what happens

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: PHP returns bad HTML
Posted by: TimMiller (---.lightspeed.hstntx.sbcglobal.net)
Date: April 02, 2020 05:14PM

Thank you, sorry, I thought PHP commands were imbedded into HTML files. It appears that the HTML and PHP are all included in the .php files. And localhost/.. makes sure my browser is running the local server. Thanks again, and I will try to read, read, read the manuals. Thanks again

Options: ReplyQuote


Sorry, only registered users may post in this forum.