Is it possible for PHP to read / analyze the current Apache VirtualHost vhosts configuration block, in particular, to get the ErrorLog and CustomLog settings?
To be clear, we do not need a path to the PHP error log that is easy to obtain.
I could not find any way in phpinfo or _SERVER/getenv() or PHP Apache ( apache_module() , apache_note() , apache_getenv() )
The code base is used for several virtual hosts on several servers, so we canβt hard-code the access paths for Apache access files and errors in PHP (or in .htaccess SetEnv or some ini / csv / any file, etc.), since it does not always match what was set in <VirtualHost> - one of the Operations can update VirtualHost, but the developer cannot update the code or something that uses the code to find the same path. We cannot have a SetEnv below or above the CustomLog line with the same value, since it is still possible that it will be updated without another (human error, etc.).
My best hope was apache_getenv() , but I tried apache_getenv('CustomLog') and it returns nothing.
It would be nice to run a series of calls to system()/exec() to run cli functions to find them, but not perfect.
ServerName may not match the current vhost being called, because ServerAlias may have a different virtual host that contains the regular expression, therefore, as soon as the path to Apache conf is found, manually grepping through the file is not ideal / reliable.
Apache 2.2.16 (Unix) PHP 5.3.3 CentOS Version 5.5 (Final)
Please tell me, I missed something obvious;)