PDO::ERRMODE_EXCEPTION ]); // Save configuration $configContent = " PDO::ERRMODE_EXCEPTION,\n" . " PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\n" . " ]);\n" . " }\n" . " return \$pdo;\n" . "}\n"; if (!is_dir(__DIR__ . '/db')) { mkdir(__DIR__ . '/db', 0755, true); } file_put_contents($configFile, $configContent); header("Location: ?step=3"); exit; } catch (PDOException $e) { $error = "Database Connection Failed: " . $e->getMessage(); } } elseif ($step === 3) { require_once $configFile; try { $pdo = db(); $schemaFile = __DIR__ . '/db/migrations/schema.sql'; if (!file_exists($schemaFile)) { throw new Exception("Schema file not found at $schemaFile"); } $sql = file_get_contents($schemaFile); $pdo->exec($sql); header("Location: ?step=4"); exit; } catch (Exception $e) { $error = "Migration Failed: " . $e->getMessage(); } } elseif ($step === 4) { require_once $configFile; try { $pdo = db(); $seedsFile = __DIR__ . '/db/migrations/seeds.sql'; if (!file_exists($seedsFile)) { throw new Exception("Seeds file not found at $seedsFile"); } $sql = file_get_contents($seedsFile); $pdo->exec($sql); header("Location: ?step=5"); exit; } catch (Exception $e) { $error = "Seeding Failed: " . $e->getMessage(); } } } ?> Platform Installer - Step <?php echo $step; ?>

Installation Wizard

Setup your platform in 5 easy steps

Step 1: Welcome & Requirements

Welcome to the platform installation wizard! We will guide you through setting up the database, migrating tables, and loading the initial data.

Step 2: Database Configuration

Enter your database credentials below. If `db/config.php` already exists, the fields will be pre-filled.

← Back

Step 3: Database Migrations

Your database configuration is valid! The next step is to create the necessary tables in your database using the schema file.

Action: Running this will execute `db/migrations/schema.sql` to build the database structure. Existing tables might be dropped and recreated.
← Back

Step 4: Database Seeding

Tables have been created successfully! The next step is to insert the initial data (seeds) into the database.

Action: Running this will execute `db/migrations/seeds.sql` to load default data, including the admin account and platform settings.
← Back

Installation Complete!

Your platform has been successfully installed and configured.

Security Warning: Please delete the install.php file from your server to prevent unauthorized re-installation.