#!/bin/bash

set -e

# if Environment is set to "dev" then touch /var/log/xdebug.log
if [ "$Environment" = "dev" ]; then
    touch /var/log/xdebug.log
    chown www-data:www-data /var/log/xdebug.log /var/www/html/prs/phpinfo.php
    chmod 644 /usr/lib/php/20220829/xdebug.so
    phpenmod xdebug
fi

# Start Apache in the background and keep cron running in the foreground
/usr/sbin/apache2ctl -k start && cron -f