Automatic rollback for PHP FPM pool and Apache VirtualHost files
Before clobbering an existing PHP pool file or Apache VirtualHost file copy the existing one to a TMP location, put the new one in place then check it with, for example, apache2ctl configtest and if that fails move the original back before failing to ensure that config isn't written that could prevent the Apache or PHP process from being restarted without an error.