Skip to content

Instantly share code, notes, and snippets.

@ArsSirek
Created May 4, 2017 21:16
Show Gist options
  • Save ArsSirek/1819aefff39730bfad8bbe38ba4639f9 to your computer and use it in GitHub Desktop.
Save ArsSirek/1819aefff39730bfad8bbe38ba4639f9 to your computer and use it in GitHub Desktop.
<?php
$status = null;
$output = "";
exec( "apachectl configtest", $output, $status );
if ( $status === 0 ) {
// allow apache2 reload to needed user
// (add - "username ALL = (root) NOPASSWD: /etc/init.d/apache2" to /etc/sudoers)
// http://serverfault.com/questions/69847/linux-how-to-give-a-user-permission-to-restart-apache
exec( "sudo /etc/init.d/apache2 reload");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment