Score:-1

Perl script to restart Apache in Windows

in flag

Is this all I need to restart Apache from within my Perl script?

system("C:\\Apache24\\bin\\httpd.exe -k restart");

I tried to verify that this actually restarts Apache, but cant find my Apache log file. And looking in Windows Task Manager under the Services tag the Apache service did not get a renewed PID number. I also checked if I could see any activity in the Windows Computer Management > System Tools > Event Viewer > Windows Logs tabs, for anything that could hint if Apache did do a restart, but did not find any activity. And now I am not sure if this code is working.

I guess I could just do a

system("C:\\Apache24\\bin\\httpd.exe -k stop");

and see if that killed Apache...


Update: I tried to stop it in my cmd window and got

(OS 5)Access is denied. : AH10014: Failed to open the 'Apache2.4' service

... come to find out I was not running under an elevated Administrator: Command Prompt window. So probably the Perl script would also not have had the right to execute that command.

Score:0
in flag

This Perl script works:

system("C:\\Apache24\\bin\\httpd.exe -k restart");

but only if it is executed in an administrative/elevated cmd.

ph flag
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/552500)
MeSo2 avatar
in flag
@DaveM I reworded it. I hope it is to your liking.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.