Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Remotly Restarting Apache |
|
Author |
|
mrtechguy
Joined: 21 Sep 2006 Posts: 7
|
Posted: Wed 11 Jul '07 6:38 Post subject: Remotly Restarting Apache |
|
|
Hello all,
I am after a script (most preferably PHP, that I can use to remotely restart an Apache 2.2.3 server, Security is *not* a problem with this I just need to be able to do it. The situation is this:
I am a student in a school where we are heavily locked down (aka no telnet, remote desktop, ssh, etc.) All machines are windows. I am running an apache server (teacher kindly set this up for me). I need a PHP scipt, or an application that can shut down and start apache (however I don't think I can remotely access RPC so services.msc won't work, Apache Monitor doesn't work either so it is looking like PHP.
Any ideas.
Cheers
MTG |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 11 Jul '07 11:30 Post subject: |
|
|
Hm, not so easy. But there is an idea for a php solution.
I haven't tested it!
Code: |
<?php
exec('C:\path\to\bin\httpd -k restart');
?>
|
or if that don't work
Code: |
<?php
exec('C:\restart.cmd');
?>
|
restart.cmd
Code: |
net stop Apache2
net start Apache2
|
|
|
Back to top |
|
Jorge
Joined: 12 Mar 2006 Posts: 376 Location: Belgium
|
Posted: Tue 17 Jul '07 10:14 Post subject: |
|
|
that a really bad idea!... when if it fails to restart you'll lose access.
I was working on a small web interface to do this but I abbandoned it.
I had a little app running (delphi) that monitored a folder where the php script would write commands.txt and the app would parse it and delete the file and wait for a new one.
using php's exec or system command gave poor result and a lot of timeouts. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 17 Jul '07 11:03 Post subject: |
|
|
Of cause it is not the best solution, no doubt about that! Without having your tool, it works to call cmd with exec('C:\path\to\bin\httpd -k restart');
Using passthru from PHP, which gives a feedback makes no sence, beauce httpd.exe gives no viewable feedback. Maybe there is a need for an apache2ctl script for Windows
So I will try out your solution if it is done. |
|
Back to top |
|
bentogoa
Joined: 09 Feb 2007 Posts: 66 Location: GOA
|
Posted: Tue 17 Jul '07 16:20 Post subject: |
|
|
Do you have php_win32service.dll ext loaded in your php configuration?
Bento Fernandes
Webmaster
http://www.goanwap.com |
|
Back to top |
|
|
|
|
|
|