Skip to content

Commit e6b70a0

Browse files
committed
Fix the setup process by adding config template
1 parent b1b7981 commit e6b70a0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

setup-config.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function setup_php()
9292
$config['PHP_INI_PATH'] = $iniPathFinal;
9393

9494
file_put_contents($configFile, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
95-
95+
echo "\n";
9696
echo "\033[0;32m config.json updated successfully!\033[0m\n";
9797
return true;
9898
}
@@ -193,11 +193,14 @@ function getVersion($cmd)
193193
// Replacing placeholder
194194
$content = str_replace("{" . $key . "}", $value, $content);
195195
}
196+
197+
196198
echo "Testing MySQL connection...\n";
197199

198200
try {
199201
// Connessione senza specificare DB
200-
$mysqli = @new mysqli($params["DB_HOST"], $params["DB_USER"], $params["DB_PASSWORD"]);
202+
$db = $params['DB_HOST'] === 'localhost' ? '127.0.0.1' : $params['DB_HOST'];
203+
$mysqli = @new mysqli($db, $params["DB_USER"], $params["DB_PASSWORD"]);
201204

202205
if ($mysqli->connect_error) {
203206
throw new Exception("Connection failed: " . $mysqli->connect_error);

0 commit comments

Comments
 (0)