How to shutdown computer using PHP Script


In this quick tutorial I am going to show you How to shutdown computer using PHP Script. You can easily configure shoutdown and reboot command in PHP and control system command from web If your Apache/PHP configuration is setup to allow the use of system, then you can use following command.

For Windows

Shutting down windows computer using php command

<?php system('shutdown -s -t 45'); //45 means shutdown after 45 seconds ?>


<?php exec('shutdown -s -t 45'); ?>


<?php shell_exec('shutdown -s -t 45'); ?>

For Linux

<?php system('shutdown -h now'); ?>

You can execute any system command by using system(), exec(), shell_exec() PHP functions