Jump to content

Restart Apcahe


ishan

Recommended Posts

I highly doubt it - you could make a system call on the server you want to restart it on, but I don't know how Apache would react to being shutdown by one of it's processes :x

 

<?php

exec("/usr/local/apache2/bin/apachectl restart");

?>

 

would do it for most custom compilations of Apache, if it would work. That would be the command to use.

 

Assuming your server is running Linux.

Link to comment
Share on other sites

I am using apache on Windows. I can stop apache service with command "net stop Apache2" but it would not start afterwards...

 

[!--quoteo(post=319097:date=Nov 16 2005, 02:15 PM:name=neylitalo)--][div class=\'quotetop\']QUOTE(neylitalo @ Nov 16 2005, 02:15 PM) 319097[/snapback][/div][div class=\'quotemain\'][!--quotec--]

I highly doubt it - you could make a system call on the server you want to restart it on, but I don't know how Apache would react to being shutdown by one of it's processes :x

 

<?php

exec("/usr/local/apache2/bin/apachectl restart");

?>

 

would do it for most custom compilations of Apache, if it would work. That would be the command to use.

 

Assuming your server is running Linux.

 

Link to comment
Share on other sites

[!--quoteo(post=320634:date=Nov 21 2005, 05:11 AM:name=Ishan Jain)--][div class=\'quotetop\']QUOTE(Ishan Jain @ Nov 21 2005, 05:11 AM) 320634[/snapback][/div][div class=\'quotemain\'][!--quotec--]

I am using apache on Windows. I can stop apache service with command "net stop Apache2" but it would not start afterwards...

 

Why can't you start it with "net start Apache2"

Link to comment
Share on other sites

[!--quoteo(post=320721:date=Nov 21 2005, 05:01 PM:name=lilcam)--][div class=\'quotetop\']QUOTE(lilcam @ Nov 21 2005, 05:01 PM) 320721[/snapback][/div][div class=\'quotemain\'][!--quotec--]

Why can't you start it with "net start Apache2"

 

Once server is down it will not execute php any futher....

and with "net stop Apache2" it is gone and script is gone.

Link to comment
Share on other sites

[!--quoteo(post=321069:date=Nov 22 2005, 02:08 PM:name=WhyWindows)--][div class=\'quotetop\']QUOTE(WhyWindows @ Nov 22 2005, 02:08 PM) 321069[/snapback][/div][div class=\'quotemain\'][!--quotec--]

You could get PHP to execute a batch file...

 

The batch file code would be:

 

net stop Apache2

net start Apache2

 

Then execute the batch file. It should continue running even when Apache is down

It should but my server just ignores all the executable files and commands exept the basc ones in the Command Promopt

Link to comment
Share on other sites

[!--quoteo(post=321071:date=Nov 22 2005, 03:11 PM:name=Ishan Jain)--][div class=\'quotetop\']QUOTE(Ishan Jain @ Nov 22 2005, 03:11 PM) 321071[/snapback][/div][div class=\'quotemain\'][!--quotec--]

It should but my server just ignores all the executable files and commands exept the basc ones in the Command Promopt

 

You could try a more extreme option - restart the entire server itself?

But you won't be able to do that if more than one site is being hosted on the pc - if its a dedicated server, it shouldn't be a problem, just use:

 

shutdown -r -f -t 00

 

This will make the pc restart immediately, forcing all services to stop.

Link to comment
Share on other sites

[!--quoteo(post=321161:date=Nov 22 2005, 08:44 PM:name=WhyWindows)--][div class=\'quotetop\']QUOTE(WhyWindows @ Nov 22 2005, 08:44 PM) 321161[/snapback][/div][div class=\'quotemain\'][!--quotec--]

You could try a more extreme option - restart the entire server itself?

But you won't be able to do that if more than one site is being hosted on the pc - if its a dedicated server, it shouldn't be a problem, just use:

 

shutdown -r -f -t 00

 

This will make the pc restart immediately, forcing all services to stop.

 

I found something called PsService, this tool can stop, start and restart a service, plus it works through PHP...

I just sends an exec command and my problem is solved...

 

Thanks guys..

 

//Ishan Jain

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.