I am piping apache log to php file in order to insert later the log to the database.
in the virtual host I have the line:
ErrorLog "|/usr/bin/php /opt/waffy/log2db.php"
in php I have:
$stdin = fopen ('php://stdin', 'r');
ob_implicit_flush (true); // Use unbuffered output
$data = "";
while ($line = fgets ($stdin))
{
$data .= $line;
}
file_put_contents("/opt/waffy/log.log",$data);
The php is invoked but the file /opt/waffy/log.log is empty.
UPDATE1
I think i have a little progress when I did
chmod +X log2db.php nothing hapend, but when I replaced X with x I stopped getting the ERR_CONNECTION_REFUSED.
but the file /opt/waffy/log.log is not created...