开发者

task scheduling in php on windows

开发者 https://www.devze.com 2022-12-18 19:02 出处:网络
I want to execute a php script after every one minute in background on windows OS, for this purpose i am using windows task scheduler in which i am giving the path of a php file after choosing Interne

I want to execute a php script after every one minute in background on windows OS, for this purpose i am using windows task scheduler in which i am giving the path of a php file after choosing Internet Explorer EXE, it works fine and after every minute opens that page in browser window and performs my wanted task.

Now the issue is that i do not want to open that browser window in front, i want this pr开发者_如何学Goocess to happen in background or at least close that browser on the fly after performing its task, i have also tried a .bat file for this process and i am killing the browser process after calling that php file, what happens is it closes the browser after opening it but does not execute that php file and does not perform my wanted task.

so in first way it performs task but keeps browser window open and in second way it closes window but does not perform task. My requirement is to execute that php code in background without opening any window in front and i want all this to happen on windows not linux. Any help from your side is welcome.


Use php.exe as mentioned, or use wget for windows.


Assuming Apache on Linux you can set up a scheduled cron job of this command:

wget -q -O - http://example.com > tmp.txt 

EDIT: Read your question a bit more thoroughly (walls of text are never conducive to good answers). As andreas says there is wget for Windows.


If the PHP is running on the same machine as your scheduler job, you can install WAMP (I'd imagine you already have?) and execute PHP from the command line:

C:\wamp\bin\php\php5.3.0\php.exe <path to your script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号