note 84947 added to function.openlog
| From: | doug dot manley at gmail dot com | Date: | Wed, 06 Aug 2008 20:29:28 +0000 |
| Subject: | note 84947 added to function.openlog | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143243@lists.php.net to get a copy of this message | ||
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 );
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 216.158.20.130
----
Manual Page -- http://www.php.net/manual/en/function.openlog.php
Edit -- https://master.php.net/note/edit/84947
Del: integrated -- https://master.php.net/note/delete/84947/integrated
Del: useless -- https://master.php.net/note/delete/84947/useless
Del: bad code -- https://master.php.net/note/delete/84947/bad+code
Del: spam -- https://master.php.net/note/delete/84947/spam
Del: non-english -- https://master.php.net/note/delete/84947/non-english
Del: in docs -- https://master.php.net/note/delete/84947/in+docs
Del: other reasons-- https://master.php.net/note/delete/84947
Reject -- https://master.php.net/note/reject/84947
Search -- https://master.php.net/manage/user-notes.php