Example 1 — Write an Info Message
Open the logger, write one informational line, and print the return value.
<?php
openlog('codetofun', LOG_PID, LOG_USER);
$ok = syslog(LOG_INFO, 'Tutorial demo message');
closelog();
var_dump($ok); How It Works
- openlog() sets the identity codetofun.
- LOG_INFO marks a normal informational event.
- syslog() hands the text to the system logger.
- closelog() closes the connection for a tidy demo.

