Web server configuration question -- this has to do with stuff that happens at config time, i.e. when the server reads the config files. For Apache, this happens when you do service apache2 restart or apachectl configtest.

I would like to check for the existence of a file without actually including it. There should be an error identifying the file if it isn't found.

Does either Apache or Nginx support such a thing?

@woozle httpd.apache.org/docs/2.4/mod/ that what you are looking for?

Not quite sure how you can manually send a debug message to the log though...

@FiXato Aha! Yes, that looks like it should work.

When you run apachectl configtest, it puts any error messages on the console, which is all I need.


@FiXato ...oh, but I see what you mean: it only does a thing if the file does exist; what I need is for something to happen if it does not...

Will poke around with this.


The filename in the section directive can take the same forms as the test variable in the section, i.e. the test can be negated if the ! character is placed directly before filename.

@FiXato Yah, so I just need to find a way to throw an error inside the section.

@woozle without actually throwing a failure state I guess?

@FiXato That would be fine. Just something to generate an error message.

@woozle it's hacky, but I guess you could then do an include on an actually non-existing file with the error message as filename?


@woozle I just don't understand I can't find an explicit DEBUG directive or something similar...

@FiXato It's a bit jank, but this seems to work:

<IfFile !${HomeDir}/cgi-bin/php7.4.cgi>
have some bad syntax to throw an error
Sign in to participate in the conversation

On the internet, everyone knows you're a cat — and that's totally okay.