Hi,
Ok, if you have little knowledge of C, no need to try to
apply the patch.
You would need a compiler, some libraries, set-up the
environment, configure, build, install...
I'll install a Windows binaries and try your configuration.
Should be easy to reproduce.
The syntax you have used is correct (Z:/bla/bla/). AFAIK,
the internals of httpd (the APR library to be precise)
already translate the '/' (Linux style) in '\' (Windows
style).
My proposal was just based on information taken from
Microsoft doc (search for "When opening a volume or
removable media drive (for example, a floppy disk drive or
flash memory thumb drive), ..." near the end of
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew).
Because, at some point, on Windows, 'CreteFileW()' is
called.
Just 2 words on the patch.
When a configuration file is parsed, when a '<IfFile
...>' directive is found, all lines up to the
corresponding </Iffile> are discarded.
To do that the function, we call 'apr_stat()' which gives
information on a file (size, name, dates...). In the
specific case, no information is requested. This is unusual.
Usually we ask for size only, or "standard" information.
The patch just changes the requirement from "do not return
anything" to "return size file only".
However, asking for no information *should still work*. The
function should tell us that the file exists or not, without
any details on the file itself, if found.
My point is that using it this way, is unusual. This could
hide a corner case (read: bug in the APR underlying library)
I've had in my todo list for a long time to setup a test
environment for Windows. It could be a good occasion to do
it. Or you could try with the supplier of a Windows binary
(Steffen from Apache lounge is following closely the project
and could be of help). Reproduce the issue with their
binaries and report to issue to them as well.
Finally, I put back the mailing list in copy, should anyone
have an opinion on it
CJ
Le 23/08/2019 à 14:12, Heather
Lotz a écrit :
Also, it would be helpful to know the expected syntax to
use in <IfFile> once the patch is applied.
For instance, does the patch expect
<IfFile
"/z/files/development/ApacheSmokeSignal.txt">
and the purpose of the patch is to
execute the code within the <IfFile> tags?
Or does the patch expect
<IfFile
"Z:/files/development/ApacheSmokeSignal.txt">
and the patch will allow the code within
the <IfFile> tags to execute as it would on a
Linux machine?
I opened the patch file in Notepad++ but don't understand
the contents.
Hello Christophe - Thank-you for the reply. Can you
please provide some instructions about how to apply
the patch?
Heather
Le 23/08/2019 à
05:04, Heather Lotz a écrit :
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?
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.
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
Hi,
would you have
the opportunity to test the attached patch?
The 0 passed to
apr_stat looks spurious to me. (but should work)
(Pure
speculation)
Also, based on Microsoft doc, could you also try:
<IfFile
"\\.\Z:">
...
and
<IfFile "\\.\Z:\">
...
CJ