Execute phpcode/script in set intervals

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MasterKalas
Forum Newbie
Posts: 5
Joined: Sat Jun 04, 2005 4:31 am

Execute phpcode/script in set intervals

Post by MasterKalas »

Is there a built in function in php that allows me to set an interval in which a php-codesegment or script will execute/run?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Why not just use a cron job?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: Execute phpcode/script in set intervals

Post by Roja »

MasterKalas wrote:Is there a built in function in php that allows me to set an interval in which a php-codesegment or script will execute/run?
Not really. You'd need to run a cronjob.
MasterKalas
Forum Newbie
Posts: 5
Joined: Sat Jun 04, 2005 4:31 am

Post by MasterKalas »

And what is a cronjob ?
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

A command in Unix/Linux that lets you schedule tasks. Windows has a similar feature. Some hosters (I know cPanel has this feature) let you handle cron jobs to execute PHP files, send e-mail etc.
MasterKalas
Forum Newbie
Posts: 5
Joined: Sat Jun 04, 2005 4:31 am

Post by MasterKalas »

So I need to contact my webhost if it is possible to execute cronjobs on their server, am I right ?
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

Most web hosts have a control panel of some sort which allows you to execute cron jobs. I'd check the nooks and crannys there first.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Do you use CPanel?
MasterKalas
Forum Newbie
Posts: 5
Joined: Sat Jun 04, 2005 4:31 am

Post by MasterKalas »

I dont even know what CPanel is =)
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

Okay, if you have hosting from a provider, they'll typically give you access to a control panel of some sort (for cPanel, it's usually accessed from http://www.yourdomain.com/cpanel/), showing how much space you've used, statistics, access to phpMyAdmin, file manager, email address etc. They usually mention it in the welcoming email. That control panel sometimes has the cron options as well.
MasterKalas
Forum Newbie
Posts: 5
Joined: Sat Jun 04, 2005 4:31 am

Post by MasterKalas »

I have a controlpanel to use but i checked and couldnt find anything about doing a conrjob, emailed their support to be sure. But if they dont have that option is there any other way to do/execute a cronjob ?
Post Reply