これは以前にある程度尋ねられましたが、解決策や受け入れられた回答はありません。質問をより包括的にしたいと思います。
共有サーバー上で PHP 経由で WKHTMLTOPDF を実行しようとしています (この場合は MediaTemple (gs))。ホストによると、これが機能しない理由はなく、実際には SSH 経由で機能しています。そう...
私はさまざまなことを試しましたが、最も基本的なものは何もせず、静かに失敗します:
exec("/path/to/binary/wkhtmltopdf http://www.google.com pdf1.pdf");
以下の完全な PHP バインディングを使用すると、エラーが発生します。これは、最善のグーグル検索にもかかわらず、理解できません。
電話:
$html = file_get_contents("http://www.google.com");
$pdf = new WKPDF();
$pdf->set_html($html);
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');
エラー:
Fatal error: Uncaught exception 'Exception' with message 'WKPDF didn't return
any data. <pre>Loading pages (1/6) [> ] 0% [======> ] 10% terminate called
after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc </pre>'
in /path/to/wkhtmltopdf.php:206 Stack trace: #0 /path/to/index.php(8):
WKPDF->render() #1 {main} thrown in /path/to/wkhtmltopdf.php on line 206
そして、これを取得したら(現在は再現できないため、以下は抜粋です):
Qt Concurrent has caught an exception thrown from a worker thread. This is not
supported, exceptions thrown in worker threads must be caught before
control returns to Qt Concurrent.
他のいくつかのオプションも試しましたが、同じ結果になりました。PDFはありません。それで、私は今何をすべきですか、どうすれば何が悪いのかを理解できますか?私のPHPレベルは基本的なものですが、最善を尽くします。