1

I want to send log entries from syslog-ng to a php script. Looking at this question: How do you know if syslog-ng stops your listening daemon? I tried to use the loop described in it:

while (!feof(STDIN)) {
    $input = fgets(STDIN);
    // do something with $input
}

Unfortunately I get the dreaded "POLLERR occurred while idle; fd='20'" message dozens of times a second from syslog-ng. Apparently this means that the script closed its stdin, but obviously my script is not doing that. Any ideas?

Community
  • 1
  • 1
jsd
  • 7,673
  • 5
  • 27
  • 47

1 Answers1

0

Ensure your php.ini sets max_execution_time to 0 for your CLI environment. Otherwise your script will be killed and stream closed by PHP Double check you edit right php.ini as most distros uses separate config files for each "type" of PHP (CLI/CGI/mod_php).

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • No luck. I put php -n nameofscript in syslog.conf so it won't load any ini files, then put all the ini_sets and set_time_limit() in the script (although php docs says there is no max execution time or time limit for command line). Still getting POLLERR occured. – jsd Aug 08 '13 at 22:57