Skip to content

Installation Guide

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

Installation Guide

Home · Developer Guide · Installation internals · Bootstrap internals

This walkthrough installs the current framework with MySQL. The actual command is cli\commands\InstallCommand in awt_src/classes/cli/commands/InstallCommand.php, backed by FrameworkInstallService. There is no CLIInstallCommand class, browser installer, --database option, or dependency-installing AWT command.

1. Check requirements

Requirement Why it is needed
PHP 8.2 or later readonly class declarations require 8.2; enums and array_is_list() require 8.1.
PDO and pdo_mysql Core installation and database queries.
DOM/libxml, JSON, session, hash, PCRE, SPL, Reflection, ctype Views, sessions, validation, hashing, loading and models. Most are bundled with ordinary PHP builds.
readline() available in CLI PHP The command loop and installation prompts call it directly.
ZipArchive (zip) Installing or updating package ZIP files.
cURL (curl) Downloading package ZIP files from URLs; optional for local ZIP installation.
mbstring Recommended for Blade string handling and display widths; package-list output has a strlen fallback.
Git Clone the framework.
MySQL server and client Create the empty database and inspect installed tables. MySQL 8+ is a practical target; no complete version matrix is enforced.
Apache with PHP and mod_rewrite, or an equivalent front-controller server Production HTTP serving. PHP's built-in server is suitable for local development.

Windows and Linux setup examples follow. The repository has no CI-supported OS matrix. Keep CLI and web PHP versions/extensions consistent. PostgreSQL and SQLite are accepted by install validation and its connection test, but MySQL-specific DDL and the normal provider's DSN prevent treating them as working installation targets. MariaDB may handle the SQL, but was not verified here.

2. Install prerequisites

Ubuntu/Debian-family Linux

Bash, any directory. Package names below follow the Ubuntu PHP, Apache and MySQL packaging model. Verify that your distribution's PHP is at least 8.2 before proceeding.

sudo apt update
sudo apt install git php-cli php-mysql php-xml php-mbstring php-zip php-curl php-readline mysql-server mysql-client
php -v
php --ini
php -m
sudo systemctl status mysql

If using Apache, add:

sudo apt install apache2 libapache2-mod-php
sudo a2enmod rewrite

The PHP/Apache packaging approach is described by Ubuntu's PHP guide; MySQL service setup follows Ubuntu's MySQL installation guide. For other Linux distributions, use their official PHP/MySQL packages and equivalent service/module configuration.

Windows

PowerShell, any directory. Install Git using the command documented by Git for Windows and Microsoft's winget install reference:

winget install --id Git.Git -e --source winget

Install a current PHP 8.2+ Windows binary using the official manual installation instructions. Extract it to a directory such as C:\Tools\php, create php.ini from the supplied development template for local use, and add the directory to your user PATH. Match PHP architecture and the required Visual C++ runtime to the downloaded build. Use the official instructions for the runtime and Thread Safe versus Non Thread Safe choice appropriate to your server.

In that php.ini, set extension_dir to the actual ext directory and enable bundled pdo_mysql, mbstring, zip and curl extensions as needed. Check loaded modules; do not add DLL entries for features already built into PHP. PHP's Windows extension instructions and PDO installation instructions explain loading extensions.

Install and configure MySQL using MySQL's Windows installation guide. Ensure the service is running and its client is on PATH, or use its full executable path. Open a new terminal after changing PATH:

Get-Command php, git, mysql
php -v
php --ini
php -m
php -r 'echo function_exists("readline") ? "readline available" : "readline missing";'

If your Windows PHP build lacks readline, use a build that provides it or run the Linux instructions in WSL. The AWT installer has no fallback input reader. Native Windows setup was reviewed against official instructions but not executed for this documentation.

3. Clone the framework

Linux Bash, a directory where you keep projects:

git clone https://github.com/Advanced-Web-Tools/Advanced-Web-Tools-Framework.git
cd Advanced-Web-Tools-Framework

Windows PowerShell, a directory where you keep projects:

git clone https://github.com/Advanced-Web-Tools/Advanced-Web-Tools-Framework.git
Set-Location Advanced-Web-Tools-Framework

All remaining php awt commands run from this repository root. Check that awt_data/config/awt_dirMap.php, awt_config.php and awt_db.php exist. The first entry-point execution creates missing framework cache/temp and public storage directories using mode 0755.

4. Dependencies

Core startup uses AWT's namespace-to-file autoloader, not a root Composer project. BladeOne and front-end libraries are already present. Composer installation is optional for the core.

5. Prepare an empty MySQL database

Linux Bash, any directory:

sudo mysql

Windows PowerShell, any directory:

mysql -u root -p

Then in the MySQL client, replace the example password:

CREATE DATABASE awt_demo CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'awt_demo'@'localhost' IDENTIFIED BY 'replace-with-your-password';
GRANT ALL PRIVILEGES ON awt_demo.* TO 'awt_demo'@'localhost';
EXIT;

The installer creates tables, not the database or user. The user needs DDL and CRUD privileges within this database for schema creation and package hooks. Keep this database dedicated to the installation.

6. Check configuration and run installation

Installation is available only when the loaded DB_TYPE constant is exactly the empty string. In a fresh checkout, inspect awt_data/config/awt_db.php. For a new installation its database fields should be unset/empty, including:

const DB_TYPE = '';

Do not clear a configured installation's DB_TYPE simply to reinstall. Installation is not idempotent, does not wrap all migrations in a transaction, and can leave tables behind after failure.

Either OS, repository root:

php awt

At awt> enter:

help install
install mysql awt_demo "" awt_demo "replace-with-your-password" "My Website" ""

The AWT prompt preserves quoted empty arguments ("" or '') and quoted values containing spaces. Using the prompt avoids differences between PowerShell versions in passing empty native-process arguments. On Linux Bash, the direct form also works:

php awt install mysql awt_demo "" awt_demo "replace-with-your-password" "My Website" ""

It still prompts and enters the command loop afterward; this is not a noninteractive installer. Password input is not hidden. For complicated passwords, review the CLI parser's quoting rules in CLIHandler.

Position Argument Actual validation/default
1 database_type Lowercased/trimmed; mysql, postgresql or sqlite only. Use mysql for this walkthrough.
2 database_name Must be nonblank; database must already exist for MySQL.
3 host Empty/blank becomes localhost. No port option is implemented.
4 username Must be nonblank, even for SQLite.
5 password String; may be empty.
6 website_name Must be nonblank; stored as the AWT Website Name setting.
7 host_path Empty/blank becomes /; stored as Hostname Path. Use / for the recommended root deployment.

There are exactly seven arguments, no installation options, and no guided prompt for missing database fields. After connection testing, the service creates awt_package, awt_table, awt_table_structure, awt_storage, awt_setting, and awt_admin, records the framework package, writes settings, and writes database constants to awt_db.php.

The CLI then asks, in order:

  1. Do you want to create an admin account? Y/n — only n (case-insensitive) skips. Otherwise enter email, password, username, firstname and lastname. Permission level is initialized to 0.
  2. Do you want to install packages? Y/n — this only registers pm in this command session. It does not prompt for an archive or install application packages.

Expected completion text: Installation completed. End the loop with EOF (Ctrl+D on Linux, Ctrl+Z then Enter on Windows) or Ctrl+C. Start a fresh php awt process before package management: constants and boot state in the installer process still reflect the uninstalled startup.

This is the end of the guide. If you have trouble please read below.

7. Configure serving and permissions

Use public/ as the document root. Keep framework source/configuration outside the web root. The root .htaccess is legacy and bypasses several resource paths; it is not the configuration for this deployment. The supplied public/.htaccess sends requests to index.php except .ico URLs. Static package assets are served by the framework's resource controller and allowlist.

Apache on Ubuntu

Example deployment path: /srv/awt/Advanced-Web-Tools-Framework. Create /etc/apache2/sites-available/awt.conf with paths matching your checkout:

<VirtualHost *:80>
    ServerName awt.local
    DocumentRoot /srv/awt/Advanced-Web-Tools-Framework/public
    <Directory /srv/awt/Advanced-Web-Tools-Framework/public>
        Require all granted
        AllowOverride FileInfo
        Options -Indexes
        DirectoryIndex index.php
    </Directory>
</VirtualHost>

Linux Bash, any directory:

sudo a2ensite awt.conf
sudo apache2ctl configtest
sudo systemctl reload apache2

Map awt.local to your server IP for local testing. Apache needs traversal/read access to source files, and its PHP worker needs write access to awt_data/storage/. For this example, using Ubuntu's www-data group, Linux Bash, deployment repository root:

sudo chgrp -R www-data awt_data/storage
sudo chmod -R g+rwX awt_data/storage

The CLI installer user needs write access to awt_data/config/awt_db.php. The account performing package install/update needs write access to awt_packages/ and storage. Normal HTTP serving need not write source or configuration. On Windows, grant the corresponding Modify permissions through NTFS ACLs for storage and the account performing installation. Do not grant blanket write access to the entire project.

Apache rewrite configuration follows the mod_rewrite reference. Other web servers must route application/resource URLs to public/index.php, preserve REQUEST_URI and HTTP method, and avoid exposing private directories. No Nginx or IIS configuration ships in this checkout.

Local development on either OS

Repository root:

php -S 127.0.0.1:8080 -t public public/index.php

This explicitly uses the front controller as the development router, including for package asset URLs. Open http://127.0.0.1:8080/. PHP documents the server as a development tool in its built-in server manual.

The default installed setting Session HTTPS Only is 'true'. For an HTTP-only local site, change that setting to 'false' in awt_setting (or with the Config API from an initialized package); otherwise the browser will not return secure session cookies and CSRF/login flows may fail. For a disposable local installation, run this in the MySQL client (not the AWT prompt):

UPDATE awt_setting SET value = 'false'
WHERE package_id = 1 AND name = 'Session HTTPS Only';

Start a fresh request after changing the setting. Use HTTPS and retain secure cookies for deployment. Set DEBUG = false in awt_config.php for production. Upload-size settings attempted with ini_set do not replace server/php.ini limits where those settings cannot be changed at runtime.

8. Verify success and install an application

Repository root, fresh process:

php awt

At the prompt:

version
pm list
routes

Expect version 27.0.0, an AWT framework record, and default storage routes. The framework does not create a home-page application route: / may correctly return 404 until an application package is installed and enabled. Build the first package, then use:

pm install /absolute/path/DemoSite.zip
pm list
pm enable 2

Replace 2 with the actual new ID from pm list. Ordinary packages are installed disabled; system packages are enabled automatically. Restart the process or issue a new web request to load new runtime code. A successful demo displays its welcome view at /hello.

Verify the six core tables with SHOW TABLES; in the MySQL client and check that DB_TYPE is populated. A completion message alone does not prove that an optional application package is active.

Troubleshooting

Symptom Cause and resolution
Class/file errors before the prompt Confirm the clone includes the three config files and namespace case matches paths. Run from the repository root.
PHP parse errors around readonly classes Use PHP 8.2+ for both CLI and web.
readline undefined Enable/provide readline or use WSL; it is required by the input loop.
Invalid number of arguments Supply all seven, preserving empty arguments with quotes at the AWT prompt.
Installation blocked because database is already set DB_TYPE is nonempty; inspect existing setup rather than reinstalling.
Database configuration is invalid. Check database/user creation, host, password and PDO driver. The connection test deliberately suppresses PDO details.
DDL errors with PostgreSQL/SQLite Accepted input does not imply working schema/provider support; use the MySQL path.
Partial schema after failure Diagnose the first failure; restore a clean disposable database or a backup before retrying. There is no rollback/reset command.
Failure writing database configuration Fix installation-user permissions on awt_db.php; tables may already have been created.
Missing DOMDocument or unwritable compiled views Enable DOM/XML and grant worker write access to framework storage/cache/compiled.
404 for every application URL Check document root, rewrite module/AllowOverride, and package enabled status. An empty framework has no application home page.
Package asset 404 Use the correct package/path case and an allowed directory/extension; private PHP/view source is intentionally not public.
403 on form submit or login never persists Send @csrf/_token or X-CSRF-TOKEN, keep the same session, and align Secure cookies with HTTPS.
ZIP install fails Enable zip, check manifest, main.php, dependency versions, writable package/temp/storage roots. URL installation also needs curl.
Command says success but routes do not change Start a new CLI process/new web request; package runtimes are loaded at startup.

See Known discrepancies for code limits that installation alone cannot fix.

Clone this wiki locally