Pages

Thursday, December 13, 2012

Konfigurasi Scheduled Job file php di Windows (XAMPP)


1. Create the PHP script for running in Scheduled Task
contoh : job.php

save di C:\xampp\htdocs\

2.  Create the Batch File
buat satu file php untuk script php yang akan dijalankan, misal cronjob.php ,

lokasi file bisa dimana saja, tapi disarankan didalam folder xampp.

Contoh :

- buka notepad

- isi dengan :

C:\xampp\php\php.exe C:\xampp\htdocs\job.php

catatan: path php.exe tergantung dari lokasi instalasi XAMPP

- save as dengan type : All Files

- save dengan nama : job.bat di D:\xampp\htdocs\

3. To Schedule the Batch File
- buka command promt

default script untuk membuat schedule job:

schtasks /create /tn UNO /tr /YOURAPP.EXE /sc HOURLY /mo 2

ketikkan :

schtasks /create /sc hour /mo 12 /tn “PHP Cron Job” /tr C:\xampp\htdocs\job.bat

4. Untuk konfigurasi Scheduled Task, bisa di setting melalui control panel → scheduled tasks

1 comment: