简体   繁体   中英

Can we use htaccess to run php script every minute without access to page directly?

I'm developing website that will run php script every minute without access to that page directly. Almost people said that I have to used cron job; but my domain doesn't have function cron job to do like other domain. So what I want to know is can we use other methods beside of cron job? For example, htaccess. Does it is possible?

Thank in advance.

I'm afraid the .htaccess file simply helps control Apache's configurations for your website. You can't launch jobs using that. Using cron is the best way to do what you want to do. If you don't have access to cron jobs, you could have a web page that controls that background worker by executing a shell command with like exec() or passthru() and manage the timer yoursel This is much more risky, since any error in your script might throw things off. You would have to manage the lifecycle of that background worker completely manually.

Maybe there are other scripts out there that might do what you want, but forget the .htaccess file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM