iframe to PHP file is downloading instead of displaying, can I display PHP inside an HTML iframe? [duplicate]

I’m developing a webpage that uses strictly PHP files because it’s a lot of repetition and I wanted to use templates for my files. Unfortunately GitHub doesn’t display PHP files like it does for HTML files so I wanted to try to use an HTML file to bypass this restriction. However, when I used an iframe to try to display the PHP files, it downloaded the file instead.

I have tried the methods shown in question 20276613 – using php inside of iframe html tags and question 50949201 – iframe downloads the html source instead of displaying it. This resulted in my HTML code looking like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <iframe align="center" width="100%" height="100%" src="pages/index.php" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
</body>
</html>

which unfortunately did not work.

Upon typing this question, I was prompted with questions 35207934 – PHP file downloading instead of displaying files and 32143755 – chrome is downloading file in iframe instead of displaying it, neither of which helped nor were relevant.

If it matters (which I think it does) I have tried this on Opera, Opera GX, Opera Air, Google Chrome, and Microsoft Edge, all most recent versions, and I am running Windows 11 Home 24H2 64x.

Is there any way I can fix this? Should I have used a different approach instead of using PHP for everything?

Thank you.