PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Is it possible to restart Windows Apache (service) on a PHP script?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Is it possible to restart Windows Apache (service) on a PHP script?

Réponse
 
LinkBack Outils de la discussion
Vieux 19/10/2007, 09h32   #1
Louie Miranda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Is it possible to restart Windows Apache (service) on a PHP script?

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

  Réponse avec citation
Vieux 19/10/2007, 09h49   #2
Robert Degen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Is it possible to restart Windows Apache (service) on a PHPscript?

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

  Réponse avec citation
Vieux 19/10/2007, 14h24   #3
Philip Thompson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

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!

  Réponse avec citation
Vieux 22/10/2007, 04h44   #4
Louie Miranda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

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

  Réponse avec citation
Vieux 22/10/2007, 10h29   #5
Peter Ford
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Is it possible to restart Windows Apache (service) on aPHP script?

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!
>>

>
>
>

  Réponse avec citation
Vieux 22/10/2007, 21h25   #6
Daevid Vincent
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?



  Réponse avec citation
Vieux 22/10/2007, 21h31   #7
Daevid Vincent
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

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?
>
>
>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 04h47.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15749 seconds with 15 queries