Reputation: 4437
explain by example : f.php :
d$=$_Get['ad'];
print d$;
index.php :
for $i=0 to 200000
// run f.php?ad=i$
run f.php but dont wait to finish f.php how can do that?
i find php asynchronus but i dont now this is working realy or existing other solution or is this best solution?!!
when use exec and how ??
Upvotes: 0
Views: 2080
Reputation: 25165
If you're running linux and have access to php CLI you can have something like this:
<?php
// this will launch worker to run something...
shell_exec('php worker.php >/dev/null &');
// the rest of the flow goes here
...
?>
worker.php
could be writting stuff to a database, sending emails, whatever...
Upvotes: 1
Reputation: 818
The term your looking for is called forking. Here is a link to all the PHP docs you will need to fork your code into async procs.
http://php.net/manual/en/function.pcntl-fork.php
Upvotes: 5