this is NOT a duplicate of another question. It's not "how to parse php in html", it's "why php isn't parsed if it's included"
I've a webproject written in PHP, using MYSQL-DB. Now I try to migrate the project from a websapce (no server-access!) running PHP 7.2 to a webspace running PHP 8.0.13. The webpages have PHP-Code included but .html-Extension. It works with .htaccess
AddType application/x-httpd-php .html .php
#or (both working)
AddType application/x-httpd-php80 .html .php
The problem: MYSQL-Connection only works when the code is directly put into the html-document but it doesn't work if the script is "included". In Example (sample.html):
<html>
<?php
/* This will work */
$host = "XXX";
$user = "XXX";
$pass = "XXX";
$daba = "XXX";
$SQLI = mysqli_connect(...)
/* This doesn't work */
include "path/xyz/dbconnection.php";
?>
</html>
It ends up with the following error-messaging: Fatal Error: Uncaught Error: Call to undefined function mysqli_connect() in...