Hi,

I want to run a script automatically in a php page. (e.g. everyday 10am). How can i do it? Except cron job.

Thanks

Hi,

I want to run a script automatically in a php page. (e.g. everyday 10am). How can i do it? Except cron job.

Thanks

i think there is not anyother option except cron job as per as my knowledge

Nope CRON was designed for running scripts (non-web related) on Linux based systems. This was then adapted to run web scripts every specified hour or hours.

So no there isn't really any alternative unless you manually run the script at 10am everyday.

Well, it is possible to run any PHP scripts at desired times and days using cron. I am using it without any hassles on a shared server.

Say if you like to run abc.php in folder /phpFiles at 10:00 everyday, a cron command like this may do the job:-

0 10 * * * usr/bin/php /phpFiles/abc.php

First 5 fileds set the time for running your cron jobs, in the order time, hour, day, month and weekday.
Next field specifies the path where php is installed on your server. If you are on a shared server, your host will be able to provide the correct path.
Last field is the path to the php file you want to execute at specified time.

Hope this helps.

Then i should speak to my web hosting company to see if they provide CRON on my Linux package.

Thanks guys.

I have to say, if you have cpanel then look for it on your cPanel, most of the Linux cPanel providers will provide this service.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.