will this ever end?

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
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

will this ever end?

Post by josh »

For all these people without cron jobs asking how they could simulate it, could they just do this:

Code: Select all

<?php
set_time_limit(0);
ignore_user_abort;
$x=true;
while ($x) {
  // Include commands to run
 include("commands.php");
  sleep(1);
}
?>
Would this just like run forever untill you kill the process?
lol

... or untill you go into commands.php and put $x=false;
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

No, But this would... (as long as you keep a browser open)

Code: Select all

<?php
sleep(1);
// run commands here
header("Location: http://www.thisdomain.com/thispage.php");
?>
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

i meant like how would you make it so the script runs forever so we run it once and thats it, you could close the browser and it keeps running
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

You just run what you have frm the command line. But it still might not run forever due to server setting and such. People should just learn how to use cron - its the easyist way to solve the problem.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Yeah I know, I always do use cron, I'm talking about these kids that come to these forums who have a free host account and no access to cron and they want to simulate it.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

pfff, they should learn to search the web then ;)

fe: http://www.webcron.org
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

timvw wrote:pfff, they should learn to search the web then ;)

fe: http://www.webcron.org
Okay, I'll bite. What search terms did you use to find that? I've tried several combinations of web, cron, cronjob, free, and so on and never found that before.

Awesome site, and I'd love to have 2-3 more to be able to offer as a backup.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

i just knew there were such free services, so i typed: "free webcron" and i found that site... now i tried some other searches and i noticed it isn't that evident to find it... ah well, kudos to my memory ;)

http://www.bitfolge.de/pseudocron-en.html saves you the time of writing what you were planning ;)
Post Reply