tags:

views:

92

answers:

3

If I do an infinite loop or a loop so big it's going to take days, will the process stop if I restart xampp? I coded something which made requests to Google and me and other people on the network started getting the search captcha. I stopped xampp and it seemed to stop but when I restarted xampp it started happening again.

It was hard to tell but it seemed to coincide.

A: 

Since PHP is a child process of the web server (in the case of XAMPP), it will stop as soon as the web server is taken down.

soulmerge
Yes of course, I'm asking if it will continue the process when xampp is restarted?
zuk1
Definitely not! Or do all your applications continue when you boot your computer? It could be that the page containing the script is called somehow after the server started, though (bookmark?).
soulmerge
Hmm that's so strange then, I even deleted the files. Nevermind it must be unrelated.
zuk1
A: 

However, you'll rarely need to run a long process after a web request. You can use PHP's Command Line Iterface (php myfile.php) to run these kind of scripts.

Bart van Heukelom
+1  A: 

No, the process will not pickup where it has left. It will start over again unless you specificly tell it to start where it stopt.

I.e. this php scruot does the utterly pointless task of adding one to a number:

$i = $_GET['i'];
while(true)
  print $i++;

If you write down the last number when stopping the server and then restart the script with the correct $_GET['i'] it will start where it has left of, but only because you made it do so. The script state is not saved when restarting.

EDIT
You could also have it safe the current state to the filesystem or database so you won;t have to enter it by hand.

EDIT 2
Ohh, so you wan't to stop the progress. If restarting XAMP didn't stop it then you will have to give more info on what is happeing since restarting XAMP should stop the execution of all PHP scripts.

Pim Jager
It will start over again? I don't want to do this, how could I prevent that. I want to end it permanently, I've deleted the files and restarted it but it still seems to be happening now.
zuk1