umgestellt auf Docker
This commit is contained in:
20
db_connection_docker.php
Normal file
20
db_connection_docker.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Docker environment variables with fallbacks for local development
|
||||
$host_name = $_ENV['DB_HOST'] ?? 'localhost';
|
||||
$database = $_ENV['DB_NAME'] ?? 'rezepte_klaus';
|
||||
$user_name = $_ENV['DB_USER'] ?? 'root';
|
||||
$password = $_ENV['DB_PASS'] ?? '';
|
||||
|
||||
$link = new mysqli($host_name, $user_name, $password, $database);
|
||||
|
||||
if ($link->connect_error) {
|
||||
die('<p>Verbindung zum MySQL Server fehlgeschlagen: '. $link->connect_error .'</p>');
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user