0

Put this in a file "a.php" and execute it. It works just fine:

#!/usr/bin/php
<?php
$p = popen('xclip -i -selection clipboard', 'w');
fwrite($p, 'Hello Word');
pclose($p);

Now make a file "b.php" and execute it:

#!/usr/bin/php
<?php
passthru('./a.php');

It hangs forever. Why?

(If you do not have xclip, you can install it with apt-get install xclip)

no_gravity
  • 579
  • 1
  • 3
  • 14

1 Answers1

2

"xclip -i -selection clipboard > /dev/null" should fix it

xclip doesn't close the STDOUT.

related to: this questions answer

Community
  • 1
  • 1
user1086377
  • 328
  • 5
  • 16