Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run php file as cron job in windows 8.1 using php.exe

We are trying to setup php file into cron job in windows 8.1 system, to call GCM push notification and to get notification in our registerrd devices.

It works fine when we run cron using any browser like Chrome , Firefox then I get GCM push notification to my registered device but, If we try same configure using php.exe then we are not getting notification to our devices.

To schedule cron we are using Task Scheduler in that our trigger setting are like :- enter image description here And in our Action tab We have set up bellow lines:-

Program / script :- D:\xampp\php\php.exe

Add arguments (optional) :- -f D:\xampp\htdocs\PushNotificationSql\tasknotification.php

Start in (optional):- D:\xampp\htdocs\PushNotificationSql enter image description here

After that We run manually then We get response as per below image but can not get notification into registered device. enter image description here

Any help will be appreciate!

like image 249
Asfak Saiyed Avatar asked Oct 30 '22 20:10

Asfak Saiyed


1 Answers

After many hurdles we got the solution of our problem

We have face three problems to make working this.

1). We have change our ActionTab to this

Program / script :- D:\xampp\php\php.exe

Add arguments (optional) :- -c D:\xampp\php\php.ini -f D:\xampp\htdocs\PushNotificationSql\tasknotification.php

Start in (optional):- [Remain empty]

This will successfully call php script from cmd using php.exe

2). In our php script there is code which is called php function from javascript and we knows that script code does not run using cmd its only handle by browser so we have change it and then it works fine.

3). And we have another php file include into this cron php file [tasknotification.php] so we have to write pull path of that included file.

like image 122
Asfak Saiyed Avatar answered Nov 07 '22 23:11

Asfak Saiyed