From 77a9293d053db28fc0e020a7d4161a703be43c70 Mon Sep 17 00:00:00 2001 From: kimbokon Date: Sun, 4 Jan 2026 16:06:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=9C=EB=B2=84=20DB=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=A0=90=EA=B2=80=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix_env.php | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 fix_env.php diff --git a/fix_env.php b/fix_env.php new file mode 100644 index 0000000..cf2202f --- /dev/null +++ b/fix_env.php @@ -0,0 +1,69 @@ + PDO::ERRMODE_EXCEPTION]); + echo "SUCCESS!\n"; + + if (isset($_GET['fix']) && $_GET['fix'] === 'true') { + echo "Updating .env to use host [$host]...\n"; + $newEnv = "APP_URL=https://sales.sam.kr/\n"; + $newEnv .= "DB_HOST=$host\n"; + $newEnv .= "DB_NAME=$db_name\n"; + $newEnv .= "DB_USER=$db_user\n"; + $newEnv .= "DB_PASS=$db_pass\n"; + $newEnv .= "DOCUMENT_ROOT=" . str_replace('\\', '/', __DIR__) . "\n"; + + if (file_put_contents($envPath, $newEnv)) { + echo "Successfully wrote to .env\n"; + } else { + echo "FAILED to write to .env. Check permissions.\n"; + } + } + break; + } catch (Exception $e) { + echo "FAILED: " . $e->getMessage() . "\n"; + } +} + +echo "\nUsage: Append ?fix=true to the URL to automatically create/update .env if a connection succeeds.\n"; +echo "SECURITY: DELETE THIS FILE AFTER USE!\n";