私のapacheにPDFlibをインストールして、自分のwordpressアプリケーションで使用するのに問題があります。設定apache + PDFlib + wordpress
私はインストールに関する別の疑問に思ったので、私はまだ、次のコマンドをしたチュートリアルPHP
続く:
echo "katleia.com.br localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
それは私が入れkatleia.com.br/worpressルートです私のページにアクセスするには私のブラウザで。
しかし、私はコマンドを与えるとき:
service apache2 restart
それはエラーで次の出口です:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 1 of /etc/apache2/conf-enabled/fqdn.conf:
Invalid command 'katleia.com.br', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
は、誰かが私にはPDFlibの構成に役立つことはできますか?私は約4時間それをワードプレスで動作させるようにしようとしており、何も権利がないので。
すでに私はwordpressプラグインをインストールしたくないという通知を残しています。このコマンドを元に戻す
UPDATE
:
echo "katleia.com.br katleia" | sudo tee /etc/apache2/conf-available/fqdn.conf
アップデート2
私は彼がエラーを与えて停止させることに成功したが、まだ動作しません。
私は、サーバーを再起動することができるようにするために、次のコマンドをしました:これで
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
service apache2 restart
を私のサーバーは、仕事に復帰し、私は上のクリックにちなんで命名されたPHPファイルにこのコードを追加テストするボタン:
try{
$pdf = new PDFlib();
} catch (Exception $e) {
echo "error: ".$e->getMessage()."<br>";
} finally {
// open a file
pdf_open_file($pdf, "test.pdf");
// start a new page (A4)
pdf_begin_page($pdf, 595, 842);
// get and use a font object
$arial = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $arial, 10);
// print text
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,",50, 750);
pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50,730);
// end page
pdf_end_page($pdf);
// close and save file
pdf_close($pdf);
}
彼は何のエラーもありませんでしたが、ファイルを試してみるとどこにも見つかりませんでした。
Update3とは
理論的にはPDFlibは実行されていることを示す出力を得ることだったが、私は私のプロンプトでそれを行うときには何も表示されません。このコマンドがあります:
# php -i |grep PDF
PDFlib
PDFlib Support => enabled
PDFlib GmbH Binary-Version => 7.0.5p3
私はこの部分をextension = pdf.so
ファイル/etc/php5/cli/php.ini
を追加することを忘れて仕事にすることができました。私はApacheを再起動した後、期待される出力を得ました。
まだどこでもtest.pdf
は表示されません。
PDFを生成し、サイト上でそれを見ることができます上記のコードではUPDATE4
try {
$p = new PDFlib();
/* open new PDF file; insert a file name to create the PDF on disk */
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->set_info("Creator", "hello.php");
$p->set_info("Author", "Rainer Schaaf");
$p->set_info("Title", "Hello world (PHP)!");
$p->begin_page_ext(595, 842, "");
$font = $p->load_font("Helvetica-Bold", "winansi", "");
$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show("Hello world!");
$p->continue_text("(says PHP)");
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=teste_do_katleia.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;
$len = mb_strlen($buf, 'ASCII');
exit();
、それは私が欲しいものではありません。私が望むのは、それをフォルダに保存し、別のページで回復することです。 誰でもこのコードを変更する必要があることを知っていますか?