How can I get Apache DirectoryIndex in PHP?

Is there a way to get an array (or something similar) of DirectoryIndex in PHP that runs under Apache? For example, I would like to be able to check if one of the DirectoryIndex files exists in a specific directory. This is due to How can I get the DirectoryIndex file name for a given URI using PHP? but he doesn’t quite ask the same thing, so please do not point to him despite his similarity.

EDIT: I would prefer not to use file parsing.

+4
source share
1 answer

Unfortunately, no, because Apache does not make it accessible through environment variables .

If you have control over the configuration, you can use the setenv directive next to DirectoryIndex . Then read it in PHP using apache_getenv() .

Otherwise, I think you will have to analyze the Apache configuration files yourself.

+4
source

All Articles