I have figured out how to use a C wrapper to setuid and call a shell script that essentially modifies the FQDN of the server (by modifying HOSTNAME, hosts and network, and calling hostname)
This is called from PHP using exec() or system(). However in order for the changes to take effect, apache needs to be stopped and started (because the server is running SSL a simple restart DOESN'T work - it complains about needing a total restart when certificate validity has changed).
But, as you may already have guessed, putting this in the script leaves apache dead - because after it is killed, the script dies, even if it has been backgrounded using & after the command in "system"
And ideas how to achieve this?
TIA
Steve