17 lines
592 B
PHP
17 lines
592 B
PHP
<?php
|
|
// Docker-only replacement for includes/conn.php; local/server config is untouched.
|
|
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
|
foreach (['MYSQL_HOST', 'MYSQL_DATABASE', 'MYSQL_USER', 'MYSQL_PASSWORD'] as $key) {
|
|
if (getenv($key) === false || getenv($key) === '') {
|
|
throw new RuntimeException('Missing database environment variable: ' . $key);
|
|
}
|
|
}
|
|
$conn = new mysqli(
|
|
getenv('MYSQL_HOST'),
|
|
getenv('MYSQL_USER'),
|
|
getenv('MYSQL_PASSWORD'),
|
|
getenv('MYSQL_DATABASE'),
|
|
(int) (getenv('MYSQL_PORT') ?: 3306)
|
|
);
|
|
$conn->set_charset('utf8mb4');
|