Alex Rivera | Logout

How do you restart Apache with a (web) button click?

Asked 2011-08-25T16:50:47.330
9

I'm playing around with my VM and the code I'm developing requires that I restart apache every time to capture the changes. I thought it would be nice to just have a bookmarklet, or link or button click I could run to do this. Any thoughts on how to accomplish this with PHP on a CentOS 5 dev VM?

Edit
Report

1 Answer

4
<?php echo shell_exec('service httpd restart &'); ?>

You might have permissions problems with such a script attempting to do this though. It sounds like you're in a full-on dev environment though, so it shouldn't matter for you to give elevated privileges to it.

answered 2011-08-25T16:57:47.503

Your Answer