Installation Guide
This guide provides comprehensive instructions for installing Pro Stock Tool in both development and production environments.System Requirements
Minimum Requirements
- PHP: 7.4 or higher
- MySQL: 5.7 or higher (or MariaDB 10.2+)
- Web Server: Apache 2.4+ or Nginx 1.18+
- RAM: 512 MB minimum (1 GB recommended)
- Disk Space: 100 MB for application files
- Browser: Modern browser with JavaScript enabled
Required PHP Extensions
mysqli- MySQL database connectivityjson- JSON encoding/decodingmbstring- Multibyte string handling
Installation Methods
- Development (Local)
- Production (Server)
- Docker
Development Environment Setup
Install XAMPP/WAMP/MAMP (Optional)
For an all-in-one solution, install a pre-packaged stack:XAMPP (Windows/Mac/Linux):Or install components separately:
Import Database Schema
Create the complete database schema:
The schema uses InnoDB for transaction support and includes indexes for improved query performance.
Post-Installation Configuration
Update API URLs
Update API endpoints in JavaScript controller files to match your installation:controllers/bodega.js
controllers/bodega.jscontrollers/categorias.jscontrollers/proveedores.jscontrollers/parametros.jscontrollers/registro.js
Enable Error Logging
Create a custom error handler:database/error_handler.php
conexion.php:
Create .htaccess for Security
Add.htaccess in the root directory:
.htaccess
Verification
Test Database Connection
Create a test filetest_connection.php:
test_connection.php
Test API Endpoints
Access the Application
Navigate to:- Development:
http://localhost:8000/login.html - Production:
https://your-domain.com/login.html
Troubleshooting
500 Internal Server Error
500 Internal Server Error
Causes:
- PHP syntax errors
- Database connection failure
- Missing file permissions
Database Connection Refused
Database Connection Refused
Solutions:
CORS Errors
CORS Errors
For Apache, ensure headers module is enabled:For Nginx, add to server block:
JSON Not Being Parsed
JSON Not Being Parsed
Check:
- Content-Type header is set:
Content-Type: application/json - No PHP warnings/notices before JSON output
- UTF-8 encoding is correct
File Upload Issues
File Upload Issues
Check PHP configuration:Update in Restart web server:
php.ini:Security Best Practices
Database Security
- Use dedicated database users with minimal privileges
- Never use
rootin production - Enable SSL for database connections
- Regular backups with encryption
Application Security
- Keep PHP and MySQL updated
- Disable PHP error display in production
- Use HTTPS for all connections
- Implement rate limiting on API endpoints
File Security
- Set restrictive file permissions (644 for files, 755 for directories)
- Protect
database/conexion.php(chmod 600) - Use
.htaccessto deny access to sensitive files - Keep configuration files outside web root when possible
Password Security
- Enforce strong password policies
- Passwords are hashed with bcrypt
- Never log or display passwords
- Implement password reset functionality securely
Backup and Maintenance
Database Backup
Automated Backup Script
backup.sh
Next Steps
Configuration
Configure advanced settings and customize the application
API Reference
Explore the complete API documentation
Features
Learn about all available features
Server Setup
Configure your web server and deploy to production