1

私は以下のphpコードを持っています:

<?php
header('Content-Type: text/HTML; charset=utf-8');
header( 'Content-Encoding: none; ' );

//$cmd = "pdf2htmlEX --zoom 1.3 --override-fstype 1 --hdpi 720 --dest-dir test test/test_data/Harsh_Singh_191_Marketing_IM18.pdf";
$cmd = "ping 127.0.0.1";
$descriptorspec = array(
  0 => array("pipe", "r"),   // stdin is a pipe that the child will read from
  1 => array("pipe", "w"),   // stdout is a pipe that the child will write to
  2 => array("pipe", "w")    // stderr is a pipe that the child will write to
);
flush();
$process = proc_open($cmd, $descriptorspec, $pipes);
echo "<pre>";
if (is_resource($process)) {
   while ($s = fgets($pipes[1])) {
       print $s;
       flush();
   }
}
echo "</pre>";

?>

このコードは、$cmd が「ping 127.0.0.1」に設定されている場合に正常に機能し、次のようにリアルタイムで php 出力を提供します。

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

しかし、pdf2htmlEX コマンド、つまり $cmd = "pdf2htmlEX --zoom 1.3 --override-fstype 1 --hdpi 720 --dest-dir test test/test_data/Harsh_Singh_191_Marketing_IM18.pdf" は機能しません。ファイルを変換してディレクトリに出力しますが、Web ページには何も表示されません。どうすればそれを機能させることができますか?

4

1 に答える 1