• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

Reboot server outside of Plesk control panel?

W

webcanada

Guest
Hey guys,

I'm trying to write a PHP script which I can put in a protected directory, that I can get to using any browser, to reboot the server. I've found that once in a while, things get messed up, or stop running, etc., and a reboot fixes it all.

I would love to be able to initiate a reboot from my phone/PDA (which can't sign into Plesk .. I'm assuming IE Mobile doesn't support JS or something else).

So I've made a script that calls:

$reboot = shell_exec("shutdown -r");

... but this doesn't seem to do anything. The domain on which this script resides has safe mode turned off, but I'm assuming there's some higher level protection that prevents a web user from rebooting the server.

Has anyone done anything similar? Perhaps there's some Plesk API way of doing this?

Thanks!
 
Don't you need s.th. like this?

$reboot = shell_exec("shutdown -r now");

or depending on your distribution perhaps
a
$reboot = shell_exec("reboot");

Good Luck :)
 
Probably it is been disabled in PHP.ini, search for disable_functions

I've got:
disable_functions = curl_exec, exec, ini_alter, parse_ini_file, passthru, shell_exec, pfsockopen, proc_close, proc_get_status, posix_six_setuid, posix_setsid, posix_setpgid, posix_kill, system, proc_nice, proc_open, proc_terminate

So your script will most definitly NOT work on my server...

edit:
Notice that PHP will run your script as apache, and i dont think that apache is allowed to reboot a server either.

Try to learn more working with ssh and restarting the services. Like /etc/init.d/httpd start|stop|restart etc.
If a services fails to start, is maybe because of an existing PID, kill the pid and try again. Or for httpd try /etc/init.d/httpd configtest, before restarting the service

SSH works perfect on a mobile/PDA, and is saver than a browser... (in my humble opinion ;) )
 
Back
Top