after years I have started again with PHP and I have now a very stupid problem where I don't know how to solve it. In each php script, after '->' the code is no longer excecuted, it is just shown in the browser.
I use Apache with PHP Version 8.1.10. Is there anything I have to configure?
Example (script taken from W3):
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
....
?>
Code is only parsed until 'if ($conn->' after the -> statement, the code is visible in the browser:
Has anyone an idea what I'm doing wrong? I have no idea anymore..
Thanks, Best regads
I tried multiple online examples, copy-pasted them 1:1, changed the browser, re-installed XAMPP.. Always the same behaivor