I want to do something very very bad. I want to create a button that restarts mysqld. Why is irrelevant for my issue.
Here is my php script ...
<?php
if(isset($_POST['restart'])){
exec("sudo /etc/init.d/mysqld restart");
}
?>
<form method="POST">
<input type="submit" name="restart" value="restart">
</form>
On any old server this usually can work. But on my locked down amazon ec2 server it doesn't. I tried putting this in the sudoers file but the button still doesn't restart mysqld.
Cmnd_Alias RESTART_APACHE = /etc/init.d/httpd restart
apache ALL =NOPASSWD: RESTART_APACHE
Cmnd_Alias RESTART_MYSQL = /etc/init.d/mysqld restart
apache ALL =NOPASSWD: RESTART_MYSQL
I'm stumped, at wits end, maybe someone here knows the solution ?