Advertisement
nshelper

Untitled

Mar 6th, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2. $output = [];
  3. // Replace 'sudo' with appropriate command if necessary
  4. exec('sudo service nginx restart', $output, $return_var);
  5.  
  6. if ($return_var === 0) {
  7. echo "Nginx service restarted successfully.";
  8. } else {
  9. echo "Failed to restart Nginx service.";
  10. // Optionally, you can also print the output to see any error messages
  11. print_r($output);
  12. }
  13. ?>
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement