Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $output = [];
- // Replace 'sudo' with appropriate command if necessary
- exec('sudo service nginx restart', $output, $return_var);
- if ($return_var === 0) {
- echo "Nginx service restarted successfully.";
- } else {
- echo "Failed to restart Nginx service.";
- // Optionally, you can also print the output to see any error messages
- print_r($output);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement