Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP 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 [EMAIL PROTECTED] wrote: On 10/19/07, Robert Degen [EMAIL PROTECTED] 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 help! -- Louie Miranda ([EMAIL PROTECTED]) 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! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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: [EMAIL PROTECTED]:/etc# cat /etc/sudoers Cmnd_Alias CHMOD = /bin/chmod Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown rootALL=(ALL) ALL www-dataALL=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?
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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED]:/etc# cat /etc/sudoers Cmnd_Alias CHMOD = /bin/chmod Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown rootALL=(ALL) ALL www-dataALL=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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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 [EMAIL PROTECTED] wrote: On 10/19/07, Robert Degen [EMAIL PROTECTED] 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 help! -- Louie Miranda ([EMAIL PROTECTED]) 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 ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :)
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
On 10/19/07, Robert Degen [EMAIL PROTECTED] 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 help! -- Louie Miranda ([EMAIL PROTECTED]) 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!
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
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 help! -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 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 help! -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :)