UBUNTU下给PHP安装pdf模块 » 荒野无灯weblog

Keep It Simple, Stupid.

荒野无灯weblog

UBUNTU下给PHP安装pdf模块

本文参考:http://cn.php.net/manual/en/install.pecl.php
http://www.pdflib.com 下载源码,然后编译安装:
wget http://www.pdflib.com/binaries/PDFlib/705/PDFlib-Lite-7.0.5.tar.gz
tar -xvzf PDFlib-Lite-7.0.5.tar.gz
cd PDFlib-Lite-7.0.5
./configure
make
make install

到http://pecl.php.net/package/pdflib下载最新版的pdflib
tar -xvzf pdflib-2.1.8.tgz
cd pdflib-2.1.8
./configure
make
make install

安装成功后可: ls /usr/lib/php5/20090626+lfs
可看到有一pdf.so的文件.
在/etc/php5/conf.d下面创建 pdflib.ini
内容为:
extension=pdf.so

重新加载配置:
sudo /etc/init.d/apache2 reload

直接在SHELL运行php ,如果报错说找不到libpdf.so.6 ,

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdf.so’ – libpdf.so.6: cannot open shared object file: No such file or directory in Unknown on line 0

可做个符号链接:
sudo ln -s /usr/local/lib/libpdf.so.6.0.5 /usr/lib/libpdf.so.6
这样以后,再重新加载配置:
sudo /etc/init.d/apache2 reload

phpinfo 可看到:
PDF Support enabled
PDFlib GmbH Version 7.0.5
PECL Version 2.1.8
Revision $Revision: 1.5.2.18 $

也可以用 pecl安装:
apt-get install php-pear
pecl install pdflib

#sudo apt-get install libgnupdf0 libgnupdf-dev

Tagged in :

All Comments (0)
Gravatar image
No Comments