Is there any way to automatically run PHP script o

2020-03-26 11:07发布

I had a script which sends sms alerts everyday. I want it to send automatically send sms by fetching message from database. Can I do it without cron. Is there any other solution. Plz help

2楼-- · 2020-03-26 11:08

Have an outside AppEngine cron job sheduler: Use google AppEngine, it's free. The outside "task" can then "callback" a PHP script of yours.

I fail to see what's wrong with using the local cron on your machine though aside from it being blocked for you to access.

3楼-- · 2020-03-26 11:10

In simple words, you can't run php scripts without using some sort of scheduler or cron...

4楼-- · 2020-03-26 11:14

This isn't the best answer as it still requires cron somewhere, but you could always setup another machine that does have cron, like your home computer for instance, to hit a page on your site which triggers the action (using a library like curl or wget).

Evening l夕情丶
5楼-- · 2020-03-26 11:15

Using third party webcron like

Summer. ? 凉城
6楼-- · 2020-03-26 11:23

You have a couple of options:

  • Emulate cron behavior: In your php code, check if the page was loaded at, or close to, the time you wish to schedule the sendout for, if the messages havent been sent yet, load the script that sends the messages in the background and flag them as sent.

  • As others have suggested, setup a cronjob somewhere else that will execute a script on your server by fetching the url via http (by using wget for example)

7楼-- · 2020-03-26 11:25

You can use a webcron service to trigger your script.

登录 后发表回答