Particularly I need to know ErrorLog
Apache configuration setting from PHP script to show the latest fatal errors.
Can PHP obtain such setting or I need to pass the log path manually?
PHP does not have a built-in command for locating the apache error log. As an alternative, you could do something like this in the apache config.
ErrorLog /var/log/apache/error_log
SetEnv APACHE_ERROR_LOG /var/log/apache/error_log
PassEnv APACHE_ERROR_LOG
In your PHP script $_SERVER['APACHE_ERROR_LOG'] should be what you are asking for.
To get Apache configuration You can setup mod_info
module. Look at this.
You get Apache configuration at link: http://localhost/server-info. Here live example.
<Location /server-info>
SetHandler server-info
AllowOverride All
Order allow,deny
Allow from all
</Location>
To get this info in php You could use:
<?php
echo(file_get_contents('http://localhost/server-info'));
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With