After some more testing, it seems that this syntax -
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
is the root cause of Apache not starting when the external storage device, mapped to Z:, is detached from the Windows 10 PC.
I tested these variants individually, which are more *nix like -
<IfFile "Z/files/development/ApacheSmokeSignal.txt">
<IfFile "/Z/files/development/ApacheSmokeSignal.txt">
<IfFile "/z/files/development/ApacheSmokeSignal.txt">
and the behavior is Apache starts whether or not Z: is attached to the PC, so that is a step in the right direction. However, the code within the <IfFile> tags never executes because when localhost:8080/miscellaneous/ is entered in a browser it always returns
a 404 error.
Another test was this -
<IfFile "/c/Users/heather.lotz/Documents/_user_files/test.txt">
which points to an existing file which is not stored on Z:. The behavior here was the same as that of the 3 *nix like tests. Apache starts whether or not Z: is attached to the PC but code within the <IfFile> tags is not executed because localhost:8080/miscellaneous/
returns a 404 error.
Does this constitute a bug of <IfFile> when used on a Windows OS?
From: Heather Lotz <knot22@xxxxxxxxxxx>
Sent: Wednesday, August 21, 2019 9:36 PM To: users@xxxxxxxxxxxxxxxx <users@xxxxxxxxxxxxxxxx> Subject: Re: conditionally create a Virtual Host?
A new file was created on Z: for the sole purpose of having a designated file for Apache to seek.
The file is called Z:\files\development\ApacheSmokeSignal.txt.
Here is what httpd-vhosts.conf looks like now:
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
<VirtualHost *:8080>
DocumentRoot "Z:/files/xampp/htdocs"
<Directory "Z:/files/xampp/htdocs">
Options Indexes
Require all granted
</Directory>
</VirtualHost>
</IfFile>
With this update in place, Apache starts fine when Z: is attached to the PC. However, when Z: is not attached to the PC Apache does not start and these lines appear in the XAMPP Control Panel console:
9:30:24 PM [Apache] Attempting to start Apache app...
9:30:24 PM [Apache] Status change detected: running
9:30:26 PM [Apache] Status change detected: stopped
9:30:26 PM [Apache] Error: Apache shutdown unexpectedly.
9:30:26 PM [Apache] This may be due to a blocked port, missing dependencies,
9:30:26 PM [Apache] improper privileges, a crash, or a shutdown by another method.
9:30:26 PM [Apache] Press the Logs button to view error logs and check
9:30:26 PM [Apache] the Windows Event Viewer for more clues
9:30:26 PM [Apache] If you need more help, copy and post this
9:30:26 PM [Apache] entire log window on the forums
There are no entries in error.log with a Wed Aug 21 21:30 or later timestamp.
Is the syntax incorrect? Note that Apache is installed in this location on the PC in question: C:\xampp\apache.
From: Eric Covener <covener@xxxxxxxxx>
Sent: Wednesday, August 21, 2019 7:27 PM To: users@xxxxxxxxxxxxxxxx <users@xxxxxxxxxxxxxxxx> Subject: Re: conditionally create a Virtual Host? On Wed, Aug 21, 2019 at 8:21 PM Heather Lotz <knot22@xxxxxxxxxxx> wrote:
> > Greetings, > > In my development environment on a Windows 10 PC I have added the following to Apache's configuration files - > > To httpd.conf: > Listen 8080 > > To httpd-vhosts.conf: > <VirtualHost *:8080> > DocumentRoot "Z:/files/xampp/htdocs" > <Directory "Z:/files/xampp/htdocs"> > Options Indexes > Require all granted > </Directory> > </VirtualHost> > > Note that Z: is mapped to an external storage device. > > With this setup, Apache successfully accesses C: on port 80 and Z: on port 8080. However, if the external storage device is not attached to the computer, Apache will not start. Is there a way to check if Z: is present, and only create the virtual host if that device is plugged in so that Apache always starts? If so, how can this be achieved? Try <IfFile> https://httpd.apache.org/docs/2.4/mod/core.html#iffile -- Eric Covener covener@xxxxxxxxx --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx |