#!/usr/bin/env bash set -euo pipefail export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y --no-install-recommends \ apache2 \ mariadb-server \ php \ libapache2-mod-php \ php-cli \ php-curl \ php-gd \ php-intl \ php-mbstring \ php-mysql \ php-xml \ php-zip \ unzip \ curl \ ca-certificates a2enmod rewrite headers expires echo "ServerName desktop-support.test" >/etc/apache2/conf-available/servername.conf a2enconf servername cat >/etc/apache2/sites-available/desktop-support.conf <<'APACHE' ServerName desktop-support.test DocumentRoot /vagrant/public Options Indexes FollowSymLinks AllowOverride All Require all granted ErrorLog ${APACHE_LOG_DIR}/desktop-support-error.log CustomLog ${APACHE_LOG_DIR}/desktop-support-access.log combined APACHE a2dissite 000-default.conf a2ensite desktop-support.conf cat >/etc/php/development-overrides.ini <<'PHP' display_errors = On display_startup_errors = On error_reporting = E_ALL date.timezone = America/New_York PHP PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')" ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/apache2/conf.d/99-development.ini" ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/cli/conf.d/99-development.ini" systemctl enable --now mariadb apache2 mariadb <<'SQL' CREATE DATABASE IF NOT EXISTS desktop_support CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'desktop_support'@'localhost' IDENTIFIED BY 'development_only'; GRANT ALL PRIVILEGES ON desktop_support.* TO 'desktop_support'@'localhost'; FLUSH PRIVILEGES; SQL apache2ctl configtest systemctl restart apache2 echo "LAMP provisioning complete: http://localhost:8080"