Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3c6d5b158e |
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM php:8.2-apache
|
||||||
|
|
||||||
|
# mod_rewrite aktivieren, welches in .htaccess genutzt wird
|
||||||
|
RUN a2enmod rewrite
|
||||||
|
|
||||||
|
# mysqli installieren
|
||||||
|
RUN docker-php-ext-install mysqli
|
||||||
|
|
||||||
|
# Repository in den Container kopieren
|
||||||
|
COPY . /var/www/html
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$GLOBALS['DATABASE_USER'] = 'username';
|
// Datenbank-Verbindungsparameter. Können mit den entsprechenden Umgebungsvariablen überschrieben werden.
|
||||||
$GLOBALS['DATABASE_PASSWORD'] = 'password';
|
$db_host = 'localhost'; // Adresse des Datenbankservers
|
||||||
$GLOBALS['DATABASE_SCHEMA'] = 'database name';
|
$db_user = ''; // Benutzername für die Datenbankserver-Verbindung
|
||||||
|
$db_password = ''; // Passwort für die Datenbankserver-Verbindung
|
||||||
|
$db_schema = ''; // Datenbank-Name, der genutzt werden soll
|
||||||
|
|
||||||
|
$GLOBALS['DATABASE_HOST'] = @$_ENV['DATABASE_HOST'] ?: $db_host;
|
||||||
|
$GLOBALS['DATABASE_USER'] = @$_ENV['DATABASE_USER'] ?: $db_user;
|
||||||
|
$GLOBALS['DATABASE_PASSWORD'] = @$_ENV['DATABASE_PASSWORD'] ?: $db_password;
|
||||||
|
$GLOBALS['DATABASE_SCHEMA'] = @$_ENV['DATABASE_SCHEMA'] ?: $db_schema;
|
||||||
|
3
db.php
3
db.php
@ -37,7 +37,8 @@ if (!file_exists(__DIR__ . '/db.conf.php')) {
|
|||||||
|
|
||||||
require 'db.conf.php';
|
require 'db.conf.php';
|
||||||
|
|
||||||
$GLOBALS['db'] = new mysqli("localhost",
|
$GLOBALS['db'] = new mysqli(
|
||||||
|
$GLOBALS['DATABASE_HOST'],
|
||||||
$GLOBALS['DATABASE_USER'],
|
$GLOBALS['DATABASE_USER'],
|
||||||
$GLOBALS['DATABASE_PASSWORD'],
|
$GLOBALS['DATABASE_PASSWORD'],
|
||||||
$GLOBALS['DATABASE_SCHEMA']);
|
$GLOBALS['DATABASE_SCHEMA']);
|
||||||
|
Loading…
Reference in New Issue
Block a user