I am puzzled that I am unable to find the answer anywhere.
I have Apache 2.2 for Windows installed on my laptop. This enables server-side includes to function when I work on my sites - even when I'm not connected to the internet.
This used to work:
But I totally broke something when I added a new domain.
I use the hosts file to resolve the IP addresses of hosts on the ".brak" domain
127.0.0.1 example.brakEach *.brak host answers pings.
Each box gets its own TLD that enables me to access each of my local sites from any box in my apartment.
this should work in Cygwin:
$ /cygdrive/c/Apache22/bin/httpd -k start -n Apache2.2Or in the Command Prompt:
c:\> \Apache22\bin\httpd -k start -n Apache2.2(One must use httpd -k install to set up httpd as a Windows Service.)
The task manager shows that the service starts but very quickly stops.
Surely this is the result of my borking the configuration but httpd exits with no messages other than an error status of 1.
To find the status of the previous command:
c:\> dir
c:\> echo %errorlevel%
0I am eternally in your debt.
2 Answers
What is the equivalent of
apachectl configteston Apache for Windows?
According to the current Apache 2.4 documentation for apachectl, configtest is equivalent to httpd -t. For reference, httpd -t allows you to:
Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D DUMP_VHOSTS is also set, details of the virtual host configuration will be printed. If -D DUMP_MODULES is set, all loaded modules will be printed.
Configuration errors for both httpd.conf and any virtual host files will also typically be caught with a manual, non-service manager service start-up (httpd -k start) ex.
You will need to stop any running Apache service before attempting httpd -k start (httpd -t should have no such requirement).
Note that while the question is in regards to Apache 2.2, the general documentation for apachectl configtest and httpd -t hasn't changed between versions 2.2. and 2.4.
I have Apache 2.2 for Windows installed on my laptop.
As of this writing, Apache 2.2 is officially End-of-Life. As of January 1st, 2018:
Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases [...] and no further evaluation of security risks will be published for 2.2.x releases.
If you don't have a compelling reason to stick with version 2.2 (ex. it's for personal use and you don't need some specialized module(s), etc.), you may want to seriously consider upgrading.
I would recommend the native (non-Cygwin) Windows builds from Apache Lounge. They generally keep pace with the latest official Apache Foundation releases (or aren't far behind) and have a decent selection of common optional modules.
(As a small side note, upgrading from version 2.2 to 2.4 will require some small syntax changes in your configuration files but nothing major).
0While this doesn't really answer my configtest question, I was able to determine why httpd won't start by looking in:
c:\Apache2.2\logs\error.logThere were many repitions of:
(OS 3)The system cannot find the path specified. : httpd.exe: could not open error log file C:/cygwin64/home/Thunderball/_Websites/Soggy/logs/error.log. Unable to open logsGoing back to cygwin I got the bad news that all but one of the folders in my home directory no longer exist!
Sucks to be me. :-(
I recently got the idea that my Acer's hard drive was failing. I can't find anything in my history that would have accidentally blown all of my data away.
Perhaps Right Now would be a good time to stop using my Acer. I'm mostly OK as I have good backups, and a Mac mini at home. I can't buy a replacement drive until I complete my project for my current contract. Until then I'm going to be a little short of cash.
I'm mostly happy with my Acer Aspire E 15, so I will replace its drive, mostly likely with an SSD, as well as its screen which is badly scratched.