How to creat cron using just PHP code
without using Cpanel
need Help with Cron jobs
Moderator: General Moderators
Re: need Help with Cron jobs
I don't think it's possible.
CronJobs are on the server-side for executing scripts at specific times or intervals, however PHP scripts can only get executed when accessed. So PHP scripts cannot do anything at a specific time because they're not being accessed. Might be able to do something by making a script that never ends by just having it looping and checking the dates, but it would probably timeout after a minute anyways.
You could check out PHPJobScheduler(although I wouldn't recommend it)
http://www.phpjobscheduler.co.uk/
The way this application works is annoying
They provide you code to put into your site. In order for it to work properly you have to have a decent amount of traffic to your website. From what I understand, the reason for that is... so when people go to the website, the coding from PHPJobScheduler triggers the application to check the date and time to see if there's any scheduled jobs that need to be sent out.
That's why I don't recommend it because you have to depend on the traffic you get on your website.
Good luck!
CronJobs are on the server-side for executing scripts at specific times or intervals, however PHP scripts can only get executed when accessed. So PHP scripts cannot do anything at a specific time because they're not being accessed. Might be able to do something by making a script that never ends by just having it looping and checking the dates, but it would probably timeout after a minute anyways.
You could check out PHPJobScheduler(although I wouldn't recommend it)
http://www.phpjobscheduler.co.uk/
The way this application works is annoying
That's why I don't recommend it because you have to depend on the traffic you get on your website.
Good luck!