Damon Malkiewicz
Damon Malkiewicz

Reputation: 463

Create an External Cron Job using PHP?

Is there a way to create an external cron job on a server using PHP?

I'm writing a Wordpress plugin that requires a scheduled task to run every 10 minutes. I'm aware of Wordpress's native WP-Cron but cannot use this because it depends on pageviews to execute. Creating the job manually through cPanel isn't an attractive option either because my userbase isn't very technical.

I have seen some suggestions about using wget and the PHP command line tool for creating cron jobs. Could either of these approaches be executed from within a PHP function, for example, something I could run during a plugin's activation hook?

Thanks!!

Upvotes: 0

Views: 901

Answers (1)

Michal
Michal

Reputation: 17

I think it´s impossible using only php (php couldn´t be started forewer it´s script). Maybe if you will be loading some page via ajax in cycle (problem - your device will need to stay online) or use some programming language no script. But cron is better solution ;)

Upvotes: 1

Related Questions