//install apache and php
sudo apt update
sudo apt install -y apache2 php libapache2-mod-php
sudo systemctl restart apache2

// create the RAM disk that holds the .csv files for status and settings
sudo mkdir /var/www/html/ramdisk
sudo nano /etc/fstab
  tmpfs /var/www/html/ramdisk tmpfs nodev,nosuid,noexec,size=5M,mode=0775 0 0
// then test
sudo mount -a

//fix permission on ramdisk so they work on reboot
sudo nano /etc/tmpfiles.d/ramdisk.conf
  d /var/www/html/ramdisk 0775 www-data pi5 -
//then apply
sudo systemd-tmpfiles --create

//fix access to the CalFiles
sudo chown -R www-data:pi5 /var/www/html/CalFiles
sudo chmod -R 775 /var/www/html/CalFiles

//install the g++ and  gpiod library so the cpp program can be compiled
sudo apt install -y build-essential gpiod libgpiod-dev

//give GPIO and I2C access to the www-data user so urebs cpp program will run
sudo usermod -aG gpio,i2c www-data
//note requires reboot to become effective

//ensure the urebs cpp executable runs under the www-data owner
//it will try to run every 5 mins, and start if not already running.
crontab -e
@reboot    sudo -u www-data /var/www/html/urebs 
*/5 * * * * sudo -u www-data /var/www/html/urebs




