[Solved] PHP is not executing in HTML [closed]


The colour of the code in your editor has no bearing on the result. In my editor, both “invalid HTML tag” and “PHP tag” are red(-ish), but that doesn’t mean they’re the same 😉

Now, as for your problem, you need to be running this on a server. Just loading the file in your browser is not enough.

If you have PHP (5.4 or newer) installed on your own computer, you can start a “development server” real easily: open up a command prompt (terminal, whatever), navigate to the folder your file is in, then run this:

/path/to/php -S localhost:8000

Then open your browser and go to http://localhost:8000/. Boom! PHP file, run!

7

solved PHP is not executing in HTML [closed]