<body>
.
.
.
<? tuo script php ?>
.
.
.
</body>

non per forza devi inserire il php in testa al file