-1

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.

MeSo2
  • 254
  • 1
  • 3
  • 18

1 Answers1

0

This Perl script works:

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

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

MeSo2
  • 254
  • 1
  • 3
  • 18
  • 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) – Dave M May 31 '23 at 15:00
  • @DaveM I reworded it. I hope it is to your liking. – MeSo2 May 31 '23 at 22:40