Getting Started

Prerequisites

Setup

  1. Clone the repository:

    git clone https://github.com/jmcoimbra/LAMP-env.git
    cd LAMP-env
    
  2. Create your environment file:

    cp .env.example .env
    

    Edit .env to set your preferred PHP version and database password:

    PHP_VERSION=8.3
    MARIADB_VERSION=11.4
    MARIADB_ROOT_PASSWORD=your-password-here
    
  3. Create the MySQL data directory (first time only):

    sudo mkdir -p /var/lib/local-mysql
    
  4. Start the environment:

    docker compose up -d
    

Verify it works

Check that PHP is running:

docker compose exec apache php -v

Create a test project:

sudo mkdir -p /var/www/test
echo '<?php phpinfo();' | sudo tee /var/www/test/index.php

Open http://test.localhost/ in your browser. You should see the PHP info page.

DNS setup

The dnsmasq container runs on port 53535. To use *.localhost domains, configure your system DNS resolver to forward .localhost queries to 127.0.0.1:53535.

macOS:

sudo mkdir -p /etc/resolver
echo "nameserver 127.0.0.1\nport 53535" | sudo tee /etc/resolver/localhost

Linux (systemd-resolved):

Add to /etc/systemd/resolved.conf:

[Resolve]
DNS=127.0.0.1:53535
Domains=~localhost

Then restart: sudo systemctl restart systemd-resolved

Stop the environment

docker compose down

Your database data persists in /var/lib/local-mysql.