I want to restart Apache when I change configuration file on a web application which is I need to create a php file for restarting Apache but I dont want to give a permission to user apache in /etc/sudoers Can someone explain intensively to me ?
Don't see this is duplicate because I am really a newbie for this apache and script I am sorry if anynoe see this as an annoying topic.
This is what I tried without giving any permission
restart.sh
#!bin/bash
/etc/init.d/httpd restart
restart.php
<?php
exec('./restart.sh');
?>
edit /etc/sudoers by add
sudo /var/www/html/home/restart.sh
when I run ./restart.sh it works perfectly but when I run
php restart.php
It can't restart giving me this error
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs