# Why does PHP not work i HTML-pages?

**URL:** <https://forum.freecodecamp.org/t/why-does-php-not-work-i-html-pages/432945>\
**Category:** General\
**Created:** [November 30, 2020, 9:27am UTC](https://forum.freecodecamp.org/t/why-does-php-not-work-i-html-pages/432945 "2020-11-30T09:27:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![O.w](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/o.w/32/209670_2.png) [@O.w](https://forum.freecodecamp.org/u/O.w)\
**Post date:** [November 30, 2020, 9:27am UTC](https://forum.freecodecamp.org/t/why-does-php-not-work-i-html-pages/432945/1 "2020-11-30T09:27:27Z")

</div>

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 🙂

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

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [November 30, 2020, 9:50am UTC](https://forum.freecodecamp.org/t/why-does-php-not-work-i-html-pages/432945/2 "2020-11-30T09:50:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:36pm UTC](https://forum.freecodecamp.org/t/why-does-php-not-work-i-html-pages/432945/3 "2021-06-01T18:36:40Z")

</div>

Closed on June 1, 2021, 6:36pm UTC


