Why does PHP not work i HTML-pages?

So I want to know why this is.

When I paste PHP-code inside an HTML-document it will not show up on the website/frontend , when using an ordinary text editor without using XAMPP or anything. When opening with liver server this shows HTML and all the rest but it does not show the PHP.

Any idea why that is? Does PHP always need one of the XAMPP, WAMP-programs to work on the frontend?

And why is that? I am trying to understand the mechanism behind it :slight_smile:

I get that PHP works with htdocs but I don’t understand the mechanism :slight_smile:

the browser can’t read php

php is a server side language, that’s why it works only if you open the files with a server

1 Like