|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Is it possible to restart Windows Apache (service) on a PHP script?
i have installed PHP/Apache on a Windows machine. Added the ext windows32 service. But could not find any how to or information online. Please ! -- Louie Miranda (lmiranda@gmail.com) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile ![]() |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Why don't you try a
passthru('net apache restart') perhabs another parameter order, but I think It won't work. Stopping it might work, but restarting... On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > Is it possible to restart Windows Apache (service) on a PHP script? > > i have installed PHP/Apache on a Windows machine. Added the ext windows32 > service. > But could not find any how to or information online. > > Please ! > > -- > Louie Miranda (lmiranda@gmail.com) > http://www.axishift.com > > Security Is A Series Of Well-Defined Steps > chmod -R 0 / ; and smile ![]() |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 10/19/07, Robert Degen <robert.degen@rwth-aachen.de> wrote:
> > Why don't you try a > > passthru('net apache restart') > > perhabs another parameter order, but I think It won't work. > Stopping it might work, but restarting... > > > > On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > > Is it possible to restart Windows Apache (service) on a PHP script? > > > > i have installed PHP/Apache on a Windows machine. Added the ext > windows32 > > service. > > But could not find any how to or information online. > > > > Please ! > > > > -- > > Louie Miranda (lmiranda@gmail.com) > This reminds me of the time I was remoting into a machine (using Altiris, I think) to do some work on it. I then needed to restart it... so I did. Well, class, what happens when you turn off Mr. Computer? Not saying that this is the same thing... b/c if you push a "restart" command, then it *should* come back up. =/ Sorry, I don't know the exact command, but consider using exec(). Good Luck, ~Philip PS... Yay, it's Friday! |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Thanks for your suggestions.
But, both did not worked. Louie On 10/19/07, Philip Thompson <philthathril@gmail.com> wrote: > > On 10/19/07, Robert Degen <robert.degen@rwth-aachen.de> wrote: > > > > Why don't you try a > > > > passthru('net apache restart') > > > > perhabs another parameter order, but I think It won't work. > > Stopping it might work, but restarting... > > > > > > > > On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > > > Is it possible to restart Windows Apache (service) on a PHP script? > > > > > > i have installed PHP/Apache on a Windows machine. Added the ext > > windows32 > > > service. > > > But could not find any how to or information online. > > > > > > Please ! > > > > > > -- > > > Louie Miranda (lmiranda@gmail.com) > > > > This reminds me of the time I was remoting into a machine (using Altiris, > I > think) to do some work on it. I then needed to restart it... so I did. > Well, > class, what happens when you turn off Mr. Computer? > > Not saying that this is the same thing... b/c if you push a "restart" > command, then it *should* come back up. =/ Sorry, I don't know the exact > command, but consider using exec(). > > Good Luck, > ~Philip > > PS... Yay, it's Friday! > -- Louie Miranda (lmiranda@gmail.com) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile ![]() |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
You could try using exec to set up an "AT" job with a short delay which will
then run 'net apache restart' - I'm not a total windows guru so I can't give you the exact recipe... Something like exec('AT 12:00 "net apache restart"'); Check the documentation on the AT command... One possible extra advantage is that you could cancel the 'AT' job during the delay period if you clicked restart by accident ![]() Louie Miranda wrote: > Thanks for your suggestions. > > But, both did not worked. > > Louie > > On 10/19/07, Philip Thompson <philthathril@gmail.com> wrote: >> On 10/19/07, Robert Degen <robert.degen@rwth-aachen.de> wrote: >>> Why don't you try a >>> >>> passthru('net apache restart') >>> >>> perhabs another parameter order, but I think It won't work. >>> Stopping it might work, but restarting... >>> >>> >>> >>> On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: >>>> Is it possible to restart Windows Apache (service) on a PHP script? >>>> >>>> i have installed PHP/Apache on a Windows machine. Added the ext >>> windows32 >>>> service. >>>> But could not find any how to or information online. >>>> >>>> Please ! >>>> >>>> -- >>>> Louie Miranda (lmiranda@gmail.com) >> This reminds me of the time I was remoting into a machine (using Altiris, >> I >> think) to do some work on it. I then needed to restart it... so I did. >> Well, >> class, what happens when you turn off Mr. Computer? >> >> Not saying that this is the same thing... b/c if you push a "restart" >> command, then it *should* come back up. =/ Sorry, I don't know the exact >> command, but consider using exec(). >> >> Good Luck, >> ~Philip >> >> PS... Yay, it's Friday! >> > > > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
What we do is setup 'sudo' to run certain commands (or a shell/ruby script
for example), then have PHP/Apache exec() the script via sudo (or use a DBUS call to a 'root' enabled ruby daemon), which then restarts apache or whatever we want. Be VERY careful with the way you do this or you can give crackers all kinds of ways to cause you pain. For example: root@daevid111:/etc# cat /etc/sudoers Cmnd_Alias CHMOD = /bin/chmod Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown root ALL=(ALL) ALL www-data ALL=NOPASSWD: /bin/date, /sbin/hwclock, REBOOT, /usr/bin/dpkg, /usr/sbin/chpasswd, /usr/bin/passwd, /usr/sbin/srvwatch, /usr/sbin/srvtalk Then in the PHP web page: exec("/usr/bin/sudo /sbin/reboot"); D.Vin "Voice or no voice, the people can alway be brought to the bidding of the leaders. This is easy. All you have to do is tell them that they are being attacked, and denounce the pacifists for a lack of patriotism and exposing the country to danger. It works the same in every country." --Hermann Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII Sound like G.W.Bush? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
DOH!. I'm sorry I didn't read the fact that this was on Windows. My bad...
Um. Out of curiosity, why would you run LAMP as WAMP? It just seems so wrong. Not to start an OS religion war, I use XP all day long, but I would never use it as my dedicated web server -- that's why God invented Unix/Linux. Best tool for the job and all that stuff... You're just asking for all kinds of headaches and limitations (such as the one you're encountering now) by using the back of a screwdriver to hammer a nail IYKWIM. You'll poke your eye out! ![]() > -----Original Message----- > From: Daevid Vincent [mailto:daevid@daevid.com] > Sent: Monday, October 22, 2007 1:26 PM > To: php-general@lists.php.net > Subject: RE: [php] Is it possible to restart Windows Apache > (service) on a PHP script? > > What we do is setup 'sudo' to run certain commands (or a > shell/ruby script > for example), then have PHP/Apache exec() the script via sudo > (or use a DBUS > call to a 'root' enabled ruby daemon), which then restarts apache or > whatever we want. > > Be VERY careful with the way you do this or you can give > crackers all kinds > of ways to cause you pain. > > > For example: > > root@daevid111:/etc# cat /etc/sudoers > Cmnd_Alias CHMOD = /bin/chmod > Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown > > root ALL=(ALL) ALL > www-data ALL=NOPASSWD: /bin/date, /sbin/hwclock, > REBOOT, /usr/bin/dpkg, > /usr/sbin/chpasswd, > /usr/bin/passwd, /usr/sbin/srvwatch, > /usr/sbin/srvtalk > > Then in the PHP web page: > > exec("/usr/bin/sudo /sbin/reboot"); > > > D.Vin > > "Voice or no voice, the people can alway be brought to the > bidding of the > leaders. This is easy. All you have to do is tell them that > they are being > attacked, and denounce the pacifists for a lack of patriotism > and exposing > the country to danger. It works the same in every country." --Hermann > Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII > > Sound like G.W.Bush? > > > |
|
![]() |
| Outils de la discussion | |
|
|