Installation & Setup
Relevant source files
The following files were used as context for generating this wiki page:
The IT Management System is a multi-tenant legacy PHP application designed for managing IT infrastructure, assets, and organizational data. The installation process is designed for simplicity, requiring no external dependency managers like Composer or NPM, and is optimized for a PHP 7.4.33 and MySQL 8.0+ environment.
This guide covers the necessary steps to deploy the application, configure database connections, and ensure the environment meets security and functional requirements. For high-level architecture details, refer to the Home page.
System Requirements
The application is built on a "Zero External Dependencies" philosophy to minimize CVE exposure and simplify deployment.
| Requirement | Version / Specification |
|---|---|
| PHP | 7.4.33 (Strictly uses MySQLi extension) |
| MySQL | 8.0+ |
| Web Server | Apache 2.4+ |
| PHP Extensions | MySQLi (PDO is not supported) |
Sources: README.md:144-149, wiki/Home.md:33-37, AGENT_NOTES.md:4-7
Installation Procedure
The installation follows a standard LAMP/WAMP stack deployment pattern.
1. Database Initialization
Administrators must first set up the MySQL backend. This involves creating a database (typically named itmanagement) and importing the provided schema and seed data.
The diagram shows the sequential flow of a standard installation from database creation to browser access.
Sources: INSTALLATION.txt:4-30, README.md:104-114
2. File and Directory Setup
Files should be extracted to the web root. Several directories must be created manually to handle file uploads and backups:
images/orequipment/: For asset photo uploads.tickets_photos/: For support ticket attachments.backups/: For database export files.floor_plans/: For building layouts (subfolders are created automatically per company).
Sources: INSTALLATION.txt:10-14, README.md:107-111
3. Configuration
The core system configuration resides in config/config.php. This file must be updated with valid database credentials.
// Database Configuration in config/config.php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', 'your_password');
define('DB_NAME', 'itmanagement');
Sources: INSTALLATION.txt:16-22, README.md:106
Security and Environment Configuration
Secrets Management
While the application supports inline constants in config/config.php, it is recommended to use environment variables to prevent credential leaks. The application includes a utility itm_load_dotenv_file() to load a .env file from the project root.
The sequence shows how environment variables are resolved during the configuration phase to establish a database connection.
Sources: README.md:213-238, wiki/Security.md:37-45
Verification and Health Checks
After deployment, administrators should run diagnostic scripts to ensure the environment is secure and correctly configured.
| Script | Purpose |
|---|---|
scripts/check_csrf_coverage.php | Audits POST handlers for CSRF protection. |
scripts/check_sql_injection_coverage.php | Static scan for unsanitized SQL queries. |
scripts/analyze_database_health.php | Runs ANALYZE TABLE on all tables to find engine errors. |
scripts/debug.php | Provides a system overview of PHP version, extensions, and permissions. |
Sources: README.md:154-162, wiki/Security.md:5-18
Troubleshooting Deployment
If the system returns HTTP 500 errors post-deployment, the following sequence is recommended:
- Syntax Validation: Run
find . -name "*.php" -print0 | xargs -0 -n1 php -lto check for PHP linting errors. - Schema Sync: Compare local
database.sqlwith the GitHub main branch to ensure the schema is up to date. - Permissions: Ensure the upload directories (e.g.,
equipment/) are writable by the web server (e.g.,chmod 755). - Table Repair: If a table reports "doesn't exist in engine", use
php scripts/repair_table_from_schema.php --table=<name>to rebuild it.
Sources: INSTALLATION.txt:37-49, wiki/Security.md:21-34
Summary
Successful installation of the IT Management System requires a standard PHP 7.4 environment with MySQLi support. By initializing the database, configuring config/config.php, and ensuring correct directory permissions, the system becomes ready for multi-tenant asset and organizational management. Security auditing via the provided scripts is a critical final step for production readiness.