note 84947 deleted from function.openlog by danbrown
| From: | danbrown@php.net | Date: | Thu, 16 Apr 2009 20:06:54 +0000 |
| Subject: | note 84947 deleted from function.openlog by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153404@lists.php.net to get a copy of this message | ||
Note Submitter: doug dot manley at gmail dot com
----
Using php 5.2.5 (I haven't tested with other versions), I cannot use "openlog" when
the PHP script is being run by apache. For some reason, when I try to call this, it randomly
crashes apache (using threads).
We use a logging class to handle logging, and this will handle the case of webserver encapsulation:
<?php
// Open a syslog with the given name.
// Note that you can only--ONLY--do this if we are NOT in apache.
// For some reason, apache segfaults when this is done.
if( !array_key_exists( 'SERVER_SOFTWARE', $_SERVER ) ) {
openlog( "My PHP Script", LOG_PID, LOG_USER );
}
?>