36516-vm/INSTALL.md
Flatlogic Bot 222297c570 5.0
2025-12-02 20:54:24 +00:00

3.8 KiB

Installation Guide

This guide will walk you through the process of installing the application on your own web hosting.

1. Server Requirements

Before you begin, ensure your hosting environment meets the following requirements:

  • Web Server: Apache with mod_rewrite enabled.
  • PHP: Version 7.4 or higher.
  • Database: MySQL or MariaDB.
  • PHP Extensions: PDO (specifically pdo_mysql).

2. Installation Steps

Follow these steps to get the application up and running:

Step 1: Upload Files

Upload all the files and folders from this project to the root directory of your web server (e.g., public_html, www, htdocs).

Step 2: Create a Database

Using your hosting control panel (like cPanel or phpMyAdmin), create a new database and a database user. Grant the user full privileges to the database. Make a note of the following:

  • Database Name
  • Database Username
  • Database Password
  • Database Host (usually localhost or 127.0.0.1)

Step 3: Configure the Database Connection

Open the db/config.php file and update the database credentials with the ones you created in the previous step.

<?php
// Generated by setup_mariadb_project.sh — edit as needed.
define('DB_HOST', 'YOUR_DATABASE_HOST');
define('DB_NAME', 'YOUR_DATABASE_NAME');
define('DB_USER', 'YOUR_DATABASE_USERNAME');
define('DB_PASS', 'YOUR_DATABASE_PASSWORD');

function db() {
  static $pdo;
  if (!$pdo) {
    $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    ]);
  }
  return $pdo;
}

Step 4: Run the Setup Script

In your web browser, navigate to http://your-domain.com/db/setup.php. This will create the necessary tables in your database. You should see a success message.

Step 5: Secure Your Installation

For security reasons, it is highly recommended that you delete the db/setup.php file after you have run it.

Step 6: Log In to the Admin Area

You can now log in to the admin area at http://your-domain.com/admin.php. The default credentials are:

  • Username: admin
  • Password: password

Step 7: Change the Admin Password

Immediately after logging in, you should change the default admin password. You can do this by navigating to the "Change Password" section in the admin area.

You can also change the admin username and password by editing the admin/config.php file:

<?php
// Simple password protection for the admin area.

define('ADMIN_USERNAME', 'new_admin_username');
define('ADMIN_PASSWORD', 'new_strong_password');

Note: The password in admin/config.php should be a hashed password. You can use the change password functionality in the admin panel to generate a new hashed password.

3. Email Configuration

The application sends emails using an SMTP server. The configuration is handled in the mail/config.php file, which reads settings from environment variables.

Option 1: Using a .env File

The most secure way to configure email is to create a .env file in the root directory of your application and add the following settings.

MAIL_TRANSPORT=smtp
SMTP_HOST=your_smtp_host
SMTP_PORT=587
SMTP_SECURE=tls
SMTP_USER=your_smtp_username
SMTP_PASS=your_smtp_password
MAIL_FROM=your_from_email@example.com
MAIL_FROM_NAME=Your From Name
MAIL_REPLY_TO=your_reply_to_email@example.com

If you are unable to use environment variables, you can modify the mail/config.php file directly. However, this is less secure as it stores your credentials in a plain text file.

4. Support

If you encounter any issues during the installation, please double-check that you have followed all the steps correctly and that your server meets the requirements.