Overview
Dashboard Dilemas uses environment variables for database credentials and can be extended with additional configuration options. The application also uses PHP constants defined inincludes/config.php for runtime configuration.
Environment File
Creating .env File
Copy the example file to create your environment configuration:Environment Variables
Variable Reference
| Variable | Default | Description |
|---|---|---|
DB_HOST | localhost | MySQL server hostname or IP address |
DB_USER | root | Database username |
DB_PASSWORD | (empty) | Database password |
DB_NAME | wordpress_db | Database name |
PHP Configuration Constants
Theincludes/config.php file defines application-wide constants that complement environment variables.
Site Configuration
Automatic Site URL Detection
The application automatically detects the site URL based on the current environment:includes/config.php
The site URL is automatically adjusted for both local development (
/dashboard-dilemas) and production environments.WordPress Integration
SMTP Configuration
Email server settings are defined as PHP constants:includes/config.php
Recommended SMTP providers: Brevo, SendGrid, or Gmail SMTP. See Email Configuration for details.
AI Integration
Gemini AI API key for enhanced features:Cron Job Configuration
For automated email reminders, configure a cron secret:cron_email_reminders.php
.env file:
.env
Configuration by Environment
Development Environment
Production Environment
Security Best Practices
File Permissions
File Permissions
Ensure
.env file has restricted permissions:Gitignore Configuration
Gitignore Configuration
Always exclude sensitive files from version control:
.gitignore
Secret Generation
Secret Generation
Generate strong secrets using:
Database User Privileges
Database User Privileges
Use a dedicated database user with minimal privileges:
Troubleshooting
Common Issues
Environment variables not loading
Environment variables not loading
Problem: Database connection fails even with correct
.env file.Solution: PHP doesn’t load .env files by default. You may need to:- Use a library like
vlucas/phpdotenv - Manually load environment variables in your web server configuration
- Set variables directly in PHP using
putenv()
SMTP connection errors
SMTP connection errors
Problem: Emails fail to send.Solution:
- Verify SMTP credentials are correct
- Check
SMTP_PORTandSMTP_SECUREsettings - Ensure firewall allows outbound connections on the SMTP port
- Check error logs in
dev/debug/error.log
WordPress path not found
WordPress path not found
Problem: Certificate emails fail with “WordPress not found” error.Solution: Update
WP_PATH constant in includes/config.php to point to your actual WordPress installation directory.Next Steps
Database Setup
Configure MySQL database and schema
Email Configuration
Set up SMTP for notifications