Create A Cron Job Php

[Solved] Create A Cron Job Php | Php - Code Explorer | yomemimo.com
Question : cron job php

Answered by : you

<?php
// Define the command to be executed by the cron job
$command = 'php /path/to/your/php_script.php';
// Define the cron schedule (e.g., run every 5 minutes)
$schedule = '*/5 * * * *';
// Build the cron command
$cronJobCommand = sprintf( "echo '%s %s' | crontab -", $schedule, $command
);
// Execute the cron job command
exec($cronJobCommand);
?>

Source : | Last Update : Tue, 19 Sep 23

Answers related to create a cron job php

Code Explorer Popular Question For Php