Example 1 — Open the System Logger
Call openlog() with a simple identity and print the boolean result.
<?php
$ok = openlog('codetofun', LOG_PID, LOG_USER);
var_dump($ok);
closelog(); How It Works
- openlog() sets the identity to codetofun.
- LOG_PID asks the logger to include the process id.
- LOG_USER is a common facility for user programs.
- closelog() closes the connection when the demo ends.

