У меня есть код для тестирования, и я не понимаю, почему он остановлен.
Скрипт выполняет только 799 переходов.
set_time_limit(0);
ini_set('display_errors', 0);
учебный класс
class CheckIpThread extends Thread {
private $ip;
public $data = null;
public function __construct ($ip_to_check) {
$this->ip = $ip_to_check;
}
public function run () {
$this->data = th($this->ip);
$this->kill;//This line probably does not matter
}
}
конец класса
for($a=0;$a<=2000;$a=$a+100)
{th_($a);}
function th_($co){
$threads = [];
for($a=0;$a<=100;$a++){
$thread = new CheckIpThread($co+$a);
$threads []= $thread;
$thread->start();
}
foreach ($threads as $thread) {
$thread->join();
}
foreach ($threads as $thread) {
echo_($thread->data);
}
}function th($wsad)
{return $wsad;//}
в прямом эфире
function echo_($text,$def=0)
{
ob_flush();
flush();
//usleep(200);
if($def===0)
{var_dump($text);}
if($def===1)
{echo($text);}
echo"</br>";
ob_end_flush();
}
// возвращаем int (0) … int (799) и браузер ждет, но ничего не происходит
проверьте журнал ошибок apache, возможно переполнение памяти.
Других решений пока нет …