Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i restart apache2 service using php script?

i am not able to restart server by using exec("sudo service apache2 restart"); in php script. i have given 777 permission to /etc/init.d/apache2. also added www-data ALL=NOPASSWD: ALL to visudo.

still can't able to restart using php script.

like image 550
Nimesh Patel Avatar asked Aug 16 '26 19:08

Nimesh Patel


1 Answers

before exec("sudo service apache2 restart"); this.

you need to set server configurations.

like image 112
vishal melwani Avatar answered Aug 19 '26 01:08

vishal melwani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!