What you’re seeing means PHP isn’t being executed at all.
Browsers never run PHP. A web server must process your .php
file and return plain HTML. If you “open” a .php
file directly from disk (e.g., file:///C:/.../index.php
) or use a static dev server (like VS Code’s Live Server), the raw PHP is sent to the browser and appears as if it’s “commented out.”
The “Quirks Mode” warning is a separate HTML issue (missing/incorrect doctype). It doesn’t make PHP run or not run.
Run with PHP's built-in server:
cd project
php -S localhost:8000
then you can open your project at http://localhost:8000/index.php
Add <!doctype html>
at the top of your HTML to stop the Quirks Mode warning.
Use <?php ... ?>
(not short tags like <? ... ?>
).