What is the recommended approach for running a daemon on a Ubuntu server to execute a PHP script periodically?

To run a daemon on a Ubuntu server to execute a PHP script periodically, you can use a tool like `cron` to schedule the execution of the script at specified intervals. This allows you to automate the execution of the PHP script without manual intervention.

<?php
// Your PHP script code here

// Example: write output to a log file
file_put_contents('/path/to/logfile.txt', 'Script executed at: ' . date('Y-m-d H:i:s') . PHP_EOL, FILE_APPEND);
?>