Guest User

Untitled

a guest
Dec 11th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors', 'stderr');
  4. ini_set('log_errors', 'Off');
  5. ini_set('log_errors_max_len', '0');
  6.  
  7. $php = proc_open(
  8.     escapeshellarg('C:\Program Files\Zend\ZendServer\bin\php.exe'),
  9.     array(
  10.         0 => array('pipe', 'r'),
  11.         1 => array('pipe', 'w'),
  12.         2 => array('pipe', 'w')
  13.     ),
  14.     $phpPipes
  15. );
  16.  
  17. fwrite($phpPipes[0], '<?php echo uniqid(); ?>');
  18. fclose($phpPipes[0]);
  19. unset($phpPipes[0]);
  20.  
  21. $null = null;
  22.  
  23. $pipes = $phpPipes;
  24.  
  25. $pipesUpdated = stream_select($pipes, $null, $null, sizeof($phpPipes) ? 0 : null);
  26.  
  27. while ($pipesUpdated !== false && $pipesUpdated > 0)
  28. {
  29.     foreach ($pipes as $pipe)
  30.     {
  31.         if (isset($phpPipes[1]) && $pipe == $phpPipes[1])
  32.         {
  33.             $start = microtime(true);
  34.             echo stream_get_contents($pipe) . "\n";
  35.             var_dump(microtime(true) - $start);
  36.  
  37.             if (feof($pipe) === true)
  38.             {
  39.                 fclose($pipe);
  40.                 unset($phpPipes[1]);
  41.             }
  42.         }
  43.         else
  44.         {
  45.             $start = microtime(true);
  46.             echo stream_get_contents($pipe) . "\n";
  47.             var_dump(microtime(true) - $start);
  48.  
  49.             if (feof($pipe) === true)
  50.             {
  51.                 fclose($pipe);
  52.                 unset($phpPipes[2]);
  53.             }
  54.         }
  55.     }
  56.    
  57.     $pipes = $phpPipes;
  58.    
  59.     $pipesUpdated = sizeof($pipes) <= 0 ? false : stream_select($pipes, $null, $null, sizeof($phpPipes) ? 0 : null);
  60. }
  61.  
  62.  
  63. echo 'Done' . "\n";
Add Comment
Please, Sign In to add comment