まずは、httpd.textを作ってサーバーにあげる。
サーバーにあがったら、名前を変更してhttpd.conf を作る。

html内でphpを動作させるための記述は以下。
MAMPとX-SERVERで動作確認。
※ Apache限定

// PHP 7 の場合 (httpd.conf に記述)
<Directory "${SRVROOT}/htdocs">
  AddHandler php7-script .php .html
  AddType application/x-httpd-php .php .html
</Directory>

// PHP 8 の場合 (httpd.conf に記述)
<Directory "${SRVROOT}/htdocs">
  AddHandler php-script .php .html
  AddType application/x-httpd-php .php .html
</Directory>