Page 1 of 1

restart apache2 from php

Posted: Wed Dec 23, 2009 5:35 am
by Mysoogal

Code: Select all


<?php

$submit = $_POST['submit'];

if($submit == "Restart") {

$message = '<p>Apache is being restarted</p>';
exec('/etc/init.d/httpd graceful');
$message .= '<p>Apache was restarted</p>';

}
echo '<html><head><title>Apache Restart</title></head><body>';
echo $message;
echo '<form action="" method="post">
<input type="submit" name="submit" value="Restart"></form>';

?>