How do I best figure out if and where Apache is installed on a windows machine?
I'm writing a script that uses the installed apache, but sets up it's own config & server-root, and I don't want to hardcode it nor have the user explicitly set it (unless necessary).
I tried to search the registry, but couldn't find anything useful.
Update for those posting default paths
On my machine, it was in C:/Program Files/Apache Software Foundation/Apache2.2. And if I had Vista 64-bit, it'd probably be under 'Program Files (x86)'. And if the computer doesn't have an English OS, it's even worse.
Workaround
Guess I have to check %PROGRAMFILES% for Apache 2.0 or 2.2's default path, then fall back to a prompt. It's be nice to read the registry and find out exactly where it is.
Final note
Apache was not installed for 'Everyone', but only the current user. That makes it a bit more difficult to find as there are no services nor registry keys/folders to point there.
You can get the path to the service exe in the services.msc too.
(my apache for some reason is installed in AppData. don't know why if it's because I've installed using chocolatey)
then
then
PS: sorry, about the portuguese in the UI. but I guess it still pretty understandable.
--
EDIT
programaticaly you may run this line in cmd and check if it helps: wmic service get PathName | findstr apache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With