I want to reload my nginx after some scenarios on my php web application with exec_shell function in php like this :
shell_exec('sudo sh /var/www/camva/subdomain.sh');
This code run after every request for reloading nginx on my route.php file.
Also my subdomain.sh shell file contains :
#!/bin/bash
sudo /etc/init.d/nginx restart
But I give this response after every request :
Reloading nginx ... fail !
I don't know why this scenario happened but I can run this command in my root with terminal command same as "sudo /etc/init.d/nginx restart"
and give correct response about reloading nginx !
Thanks for your help.