AUTOMATIC SCHEDULE A TASK IN PHP
AUTOMATIC EXECUTION CODE
1. Cron Jobs
2.Schedule a Task
What is Schedule a Task?
In case to set time, automatically execute any script or logic then we can define "Schedule". That script can execute particular date, week, month, hours, daily etc. In PHP in easy way to do Schedule task. so many methods in command line arguments code.
In PHP, Webserver have Schedule task section
Add Task
Have three option
Run Command
Fetch URL
Run a PHP Script
httpdoc/crontask.php
If you need PHP script execute automatically, then specify / Browse the PHP file
Ex: httpdoc/crontask.php
<?php
$st=date("Y-m-d");
include("config.php");
$q="insert into crontask values('','$st')";
$r=mysqli_query($con,$q);
?>
Select Cron Style : */1 * * * *
It means Each 1 mins script run automattically.
use the UNIX crontab format "min hour day-of-month month-of-week"
for example 0 22 ** 1-5.
Webserver Plesk use the default system timezome to run the task.
NOTE :
In case timezone not working in your server, Configure the PHP.INI file, set timezone settings.
What of need your automatic schedule task and command set after apply the settings
Finally Run the Task
Thats all.. Your code automatically working when your server on/off anytime, that code was working automatically.