0

My HTML has this:

<?php
echo '<p>Hello world!</p> ';
?>

The browser shows this:

Hello world!

    '; ?> 

Why is '; ?> showing?

I have tried same line, different lines, taking paragraph markers out, single quotes or double quotes. Nothing works.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 2
    What does the page _source_ show? Server may not be parsing/processing the PHP at all.... – Kevin_Kinsey Jan 04 '18 at 22:43
  • Make sure your server is set to parse your file (which you don't say the name of) as PHP. In the Apache server, this may involve fixing the server's config files, or might be as simple as a directive written into an .htaccess file. In nGinx, you might need to read here: https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ – Kevin_Kinsey Jan 04 '18 at 22:47

1 Answers1

0

The file extension of your web page must be .php rather than .html - when PHP is embedded within a .html file the browser will simply not process the content hence why you're seeing this.

A server can be configured to thread .html pages as PHP but yes as I say, you'll most likely just want to rename your file to .php I suspect.