Are there alternative methods to rebooting a server from a PHP script without using the exec function?

The issue with using the exec function in PHP to reboot a server is that it can pose security risks and may not be allowed on all server configurations. An alternative method to rebooting a server from a PHP script is to use a server-side script, such as a shell script or a cron job, that is triggered by the PHP script to perform the reboot.

// Example of triggering a shell script to reboot the server
shell_exec('sh /path/to/reboot_script.sh');