Overview
Seguridad is a PHP-based police security and incident management system designed for regional police units. This guide will walk you through the complete installation process, from system requirements to initial configuration.System Requirements
Before installing Seguridad, ensure your server meets the following requirements:Web Server
- Apache 2.4+ or Nginx 1.18+
- mod_rewrite enabled (Apache)
- URL rewriting support
PHP
- PHP 5.6+ (7.4+ recommended)
- PostgreSQL extension (php-pgsql)
- Session support enabled
Database
- PostgreSQL 9.6+ (12+ recommended)
- Minimum 2GB storage
- UTF-8 encoding support
System
- Linux/Unix-based OS (recommended)
- 2GB+ RAM
- 5GB+ available disk space
Installation Steps
Install Dependencies
First, install the required system packages:
Make sure the PostgreSQL extension for PHP is properly enabled in your
php.ini file.Configure PostgreSQL Port
By default, Seguridad connects to PostgreSQL on port 5434. Update your PostgreSQL configuration:Edit Then restart PostgreSQL:
/etc/postgresql/[version]/main/postgresql.conf:Alternatively, you can modify the application to use the default port 5432 by editing the connection files.
Configure Database Connection
Update the database connection settings in the main configuration files:Edit Edit
index.php (lines 5-7):index.php
miconexion.php (lines 32-34):miconexion.php
Import Database Schema
Import the database schema and initial data:The database should include at minimum:
- usuario table: User authentication and permissions
- Regional unit tables (UR 1-15)
- Incident and case management tables
Contact your system administrator for the complete database schema file if not included.
Configure Web Server
Set up Apache virtual host configuration:Create Enable the site:
/etc/apache2/sites-available/seguridad.conf:Configure PHP Session Settings
Ensure PHP sessions are properly configured:Edit Restart Apache:
/etc/php/[version]/apache2/php.ini:Initial User Setup
Create an initial administrator user in the database:User Permission Levels
The system uses numeric permission codes to control access:| Permission Code | Role | Access Level |
|---|---|---|
0 | System Admin | Full system access |
1-15 | Regional Units | UR1 through UR15 access |
20, 200 | Consultation | Read-only access |
21-28 | Judicial Access | Court jurisdiction access |
90-99 | Special Units | Operations, toxicology, etc. |
100 | Administrator | Administrative panel |
800-807 | Specialized | Vehicle search, maps, etc. |
4444 | Federal | Federal crimes access |
dirseguridad | Director | Security director dashboard |
Sub-jefe | Deputy Chief | Map consultation |
comisaria | Police Station | Station-level access |
Post-Installation Configuration
Configure Session Timeout
Editmiconexion.php to adjust session timeout (currently disabled):
Set Up Regional Units
Create directories for each regional unit if not present:Configure File Upload Limits
For incident reports with attachments, increase PHP upload limits:php.ini
Troubleshooting
Cannot connect to PostgreSQL
Cannot connect to PostgreSQL
- Verify PostgreSQL is running:
sudo systemctl status postgresql - Check port configuration in
postgresql.conf - Verify pg_hba.conf allows connections from localhost
- Test connection:
psql -U postgres -h localhost -p 5434
Login page displays but login fails
Login page displays but login fails
- Verify database connection parameters
- Check if
usuariotable exists and has data - Review PHP error logs for SQL errors
- Ensure php-pgsql extension is loaded:
php -m | grep pgsql
Session errors or redirects
Session errors or redirects
- Verify session directory permissions:
/var/lib/php/sessions - Check session configuration in
php.ini - Clear browser cookies and try again
- Review
miconexion.phpsession initialization
Missing images or CSS
Missing images or CSS
- Verify file permissions:
chmod -R 755 /var/www/seguridad - Check Apache configuration for static file serving
- Verify
imagenes/andSpryAssets/directories exist - Check browser console for 404 errors
Security Hardening
Before deploying to production, implement these security measures:Update Authentication
- Replace plain text passwords with hashed passwords (bcrypt)
- Implement prepared statements to prevent SQL injection
- Add CSRF token validation for forms
Restrict Database Access
- Create a database user with limited privileges
- Use environment variables for credentials
- Enable PostgreSQL SSL connections
Enable HTTPS
- Install SSL certificate (Let’s Encrypt recommended)
- Force HTTPS redirects
- Set secure session cookies
Next Steps
Once installation is complete, proceed to the Getting Started guide to learn how to use the system.Getting Started
Learn how to log in, navigate the system, and perform common tasks