Skip to content

Local Development Setup

This guide will help you set up a local development environment for the My Marketing Pro application.

  • PHP 7.4+: Built-in PHP development server
  • MySQL 8.0: Database server (via Homebrew on macOS)
  • Git: Version control
  • SSH Access: Configured access to production server
Terminal window
# Install MySQL
brew install mysql
# Start MySQL service
brew services start mysql
# Verify it's running
brew services list | grep mysql
Terminal window
# Connect to MySQL
mysql -u root
# Create the database
CREATE DATABASE mmp_app;
# Exit MySQL
exit
Terminal window
cd ~/Desktop/mmp
git clone https://github.com/my-marketing-pro/mmp-webapp.git
cd mmp-webapp

Use the Makefile command to sync the production database schema to your local environment:

Terminal window
# Full sync: export from production and import locally
make db-sync

Or do it manually:

Terminal window
# Export from production
make db-export
# Import to local
make db-import

The application auto-detects whether you’re running locally or in production based on the hostname.

Check your config files:

  • config.php - Main configuration
  • includes/config.php - Additional configuration
  • includes/db.php - Database connection

These files already have localhost detection built in:

if ($_SERVER['HTTP_HOST'] === 'localhost' || strpos($_SERVER['HTTP_HOST'], 'localhost:') === 0) {
$host = 'localhost';
$db = 'mmp_app';
$user = 'root';
$pass = '';
}
Terminal window
# Start server on http://localhost:8000
make server
# Or manually:
php -S localhost:8000

Open your browser and navigate to:

Terminal window
# Start MySQL
make db-start
# Stop MySQL
make db-stop
Terminal window
# Sync production schema to local
make db-sync
Terminal window
# Connect to local database
mysql -u root mmp_app
# Check tables
SHOW TABLES;
# View database structure
DESCRIBE app_users;

If port 8000 is already in use:

Terminal window
# Use a different port
php -S localhost:8001

Check if MySQL is running:

Terminal window
brew services list | grep mysql

If it’s not running:

Terminal window
brew services start mysql

If the database import fails, check that:

  1. MySQL is running
  2. The database mmp_app exists
  3. The schema file exists at /tmp/mmp_app_schema.sql
Terminal window
# Verify file exists
ls -lh /tmp/mmp_app_schema.sql
# Check database exists
mysql -u root -e "SHOW DATABASES LIKE 'mmp_app';"