1.11M Members

Restart Apache server through php

 
0
 

Can anyone tell me, How can i restart the apache server through php code?


if i view a specific page,my apache server should be automatically restart.
How can i perform this?

Anybody Please help me.

 
1
 

I haven't tried but exec may help you.

exec('/etc/init.d/httpd graceful');
 
0
 

It is not working. do i need to give some permission to system files? i m using linux.

 
0
 

Why would you do that??
You may find a better solution to your problem if you tell us about it.
Also, if you're running your program on the internet, the server administrator must have banned changing the status of Apache.. That's, of course, because the server, mostly, has more than one website hosted on it... So restarting Apache on the server will mostly cause a problem to the other websites operating on that very server.

 
0
 

i just pointed apache as a example. Really i have to restart a application (it is smokeping) . evry time if i change the configuration file i have to restart manually.

so i need to have auto restart.
Is there any way to restart through php codes? i tried exec(),shell_exec(),system().
they are not working.

Any solutions plz ?

 
1
 

I don't know whether these functions can also be disabled by the server administrator.
You can refer to the manual of PHP:
http://www.php.net/manual/en/ref.exec.php

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: