David Pollak
David Pollak

Reputation: 60

run php script once in a week

every Monday I need to empty few fields of a MYSQL database I have

Firstly I thought about using a cron job, but my Web Hosting provider (fatcow.com) doesn't support neither SSH or Command Lines into shared servers.

I've also thought about checking the date() to see if it's monday and perform something, but then I need to run that specific page continuously and I've read that it's a problem.

So now I ask you, how can I do this ?

Thanks for answers

Upvotes: 3

Views: 3244

Answers (6)

Sondre
Sondre

Reputation: 1898

Should be possible to setup some kind of job in mysql itself. Not 100% sure about it, but read up on

CREATE EVENT something ON SCHEDULE

And maybe you find a way to do it from MySQL instead of PHP. Sorry I can't be of more help, just thought you'd might want to check it out

MySQL Events

Upvotes: 1

Phoenix
Phoenix

Reputation: 4536

What's the control panel for that host? cPanel? If so, cPanel almost always has a Cron tool under Advanced. Could also potentially do an exec or system command from a php script to set up the Cronjob (unless that's what you mean by not supporting 'command lines').

Upvotes: 0

Linus Kleen
Linus Kleen

Reputation: 34632

If your job can reached via a URL, you might try to sign up with a free crontab service like onlinecronjobs.com

Upvotes: 1

Shameer
Shameer

Reputation: 3066

If you have access to any other server that will allow to run cron job, you can create a php file there and run your url to be executed from that server. Use curl, wget or streams to do this.

Upvotes: 3

Popop56
Popop56

Reputation: 1

If you have access to another server (with ssh) just add a cron job on it that hit your php script once a week. Unfortunately i don't think there is a way to do it directly on your php script.

Upvotes: 0

jnpdx
jnpdx

Reputation: 52397

If you have access to any other servers that do allow cron, since FatCow doesn't, you could make a cron job that calls wget on a php script on your server -- eg wget http://example.com/fake-cron.php

Upvotes: 2

Related Questions