Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't compile pdflib into PHP 5 1

Status
Not open for further replies.

georgeocrawford

Technical User
Aug 12, 2002
111
0
0
GB
Hi,

I would very much like some help with compiling PHP 5 on my machine. It's all gone well so far, with one small problem.

I am running Mac OS X 10.3.4. I downloaded the first true release of PHP 5. Then I investigated the various libraries I need to include in the compilation. I found that I could get them from Fink, so I installed gd, freetype2, libxml2, libjpeg, libpng3 and pdflib. I also installed Apache 2, which is working nicely.

My configure line is currently as follows:
Code:
./configure  --prefix=/usr/local/lib/php5  --with-zlib  --with-iconv=/sw/  --without-bundle-libxml  --with-dom=/sw/  --with-libxml-dir=/sw/  --with-xsl=/sw/  --with-gd  --with-freetype-dir=/usr/X11R6/  --with-jpeg-dir=/sw/  --with-png-dir=/sw/  --enable-sockets  --enable-pcntl  --enable-shmop  --enable-sysvshm  --enable-sysvsem  --with-mysql=/usr/local/mysql/  --enable-debug  --with-apxs2=/usr/local/apache2/bin/apxs --with-pdflib=/sw/

The problem is that whatever I seem to do, pdflib support is NOT compiled into php. I have to admit I have no idea what's going on really, but I've read lots on various websites about it.

The resulting installation pf PHP 5 works very well - the gd and xml functions are fine. But I find no mention of PDF functionality in phpinfo(). When I look at the verbose output from the configure command, the only mention of PDF is in this line:

Code:
checking for cpdflib support... no

At no point does it seem to check for pdflib support. What have I done wrong?

I have tried changing the path for pdflib to /usr/local/, in an attempt to use the libraries from my PHP 4 installation. Same problem.


Please, please, please can someone help?!!!

______________________

George
 
Support for PDFLib is apparently no longer a part of the core PHP source distribution. It has been moved to a PECL package.

There are problems with using the bundled GD library and the pdflib PECL package in the same build. Header files are not copied where they should be.

See for more information.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks very much for that slepnir - I'm glad it wasn't just me going mad!

I'd like to ask two further questions. Firstly, is there any way I can compile PHP5 with both GD and pdflib support? Any trick, or short cut, or whatever? Would it work to install the pdflib extension from PECL? I don't understand how to install an extension from PECL - could you explain how, or point me to a tutorial? When I run sudo /usr/local/php5/bin/pear -v install pdflib I get asked for the path to my pdflib installation, so I have to install that first, right? Can I use the copy from PHP4, or the copy from Fink, or do I need a new one?

Secondly, failing that, do you know which PDF package (i.e. either library, extension or external class) would be closest to pdflib in terms of its functions? I've written a long and complex script which creates a PDF and a PNG simultaneously, and I really don't want to have to change the PDF functions unless I have to. I need full functionality - i.e. Bezier curves, etc, etc.

Thanks again!

______________________

George
 
Well, I've got somewhere at least.

I downloaded the PECL wrapper for pdflib, and installed it pointing to /sw/ as my directory for pdflib. It generated a file called pdf.so.

With a bit of shifting things around, I discovered that if I put pdf.so in the path /usr/local/php5/lib/php/extensions/pdf.so, and put a php.ini file at /usr/local/php5/lib/php.ini including the line:

Code:
extension=pdf.so

... then when I run:

Code:
php -i

to start the CLI version of PHP5, I do get a reference to PDF:

Code:
PDF Support => enabled
PDFlib GmbH Binary-Version => 5.0.1
Revision => $Revision: 1.134 $

However, running a test PDF script results in an error on the first PDF function, proving the extension isn't properly loaded.

I can't get the PDF support lines to appear in the Apache module using phpinfo() at all.


I am totally stuck. I have no idea what I'm doing. Please can someone help me!!!!!!!

______________________

George
 
Sorry for the delay - I've been away with work.

So I compiled cpdflib, and tried to work with it for a bit.

The problems are many - I have loads of Bezier curve and polygon drawing routines, and I need to embed some fonts in the PDFs. Changinf to cPDFlib is going to be an absolute nightmare, and will take me ages.

I would dearly love some step-by-step help on exactly how to get pdflib working with PHP5. Incredibly, I can't find any illuminating reference to the partnership using Google.

______________________

George
 
Good advice, I'm sure. I'm actually running 4.3.8 already with a different Apache installation.

My reason for all this palaver is firstly to check my scripts are compatible with PHP5, and secondly to branch off and extend some functionality using PHP5's new OOP features.

I would like to run both versions of PHP concurrently, both with pdflib. I feel you're suggesting I give up???!!!!

______________________

George
 
I am not suggesting you give up. I am suggesting you wait until the boys in the back room of Zend get their install straightened out.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks for the confidence - it's nice to know it might not be me being thick this time! I'll keep my eyes open for any news.

Case closed for now.

______________________

George
 
Will it do Bezier curves and polygons?

______________________

George
 
It doesn't say in the docs, either way. Its free, so why not try it?

Bastien

Cat, the other other white meat
 
Hi George,

I recently began a quest to see if I could get the new PDFlib 6.0.0p1 PECL package to work with a stock Panther (10.3.4) install.

The "stock" Panther install includes Apache/1.3.29 (Darwin) PHP/4.3.2

First, I installed the latest PECL package manager:

% curl | php

Got the latest PDFlib/PECL package:


Downloaded the latest dmg from pdflib.com:


Placed the pdflib-2.0.1.tgz pecl package in the bind/php/pecl directory from the dmg download.

Enabled root access from Panther's NetInfo Manager.

##Switched to root:
fwunder$ su root
Password:
##Switched shell to Bourne
Computer:/Users/fwunder root# sh
sh-2.05b#
##Navigated to my install direcotry
sh-2.05b# cd /Users/fwunder/Documents/php_install/bind/php
##Per many recommendations, set LDFLAGS
sh-2.05b# LDFLAGS='-framework Carbon'
sh-2.05b# export LDFLAGS
##Tried PECL install
sh-2.05b# pear install pecl/pdflib-2.0.1.tgz

This failed. It took me a while to see what was happening, but finally I realized that phpize could not follow libtoolize->glibtoolize:

sh-2.05b# phpize
/usr/bin/phpize: line 44: libtoolize: command not found

So, on a whim, I simply edited /usr/bin/phpize, changing "libtoolize" to "glibtoolize".

##Tried PECL install
sh-2.05b# pear install pecl/pdflib-2.0.1.tgz

Success! The process completed with:
(...)
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

pdf.so copied to /private/tmp/tmpTCmjg8/pdflib-2.0.1/pdf.so

Build process completed successfully
Installing 'pdf.so' at ext_dir (/usr/lib/php/extensions/no-debug-non-zts-20020429/pdf.so)
install ok: pdflib 2.0.1
(...)

Moved pdf.so to /usr/lib/php/extensions/
Edited php.ini to point to "/usr/lib/php/extensions/" and added pdf.so

extension_dir = "/usr/lib/php/extensions"
extension=pdf.so

Restarted Webserver via System Preferences.

phpinfo(); now shows:

pdf
PDF Support enabled
PDFlib GmbH Version 6.0.0p1
PECL Version 2.0.1
Revision $Revision: 1.55.2.5 $

Everything at this point looks great!! The problem is, it doesn't work...:(

Actually, I think I am very close. When trying to run pdflib code, "/var/log/httpd/error_log" shows:

dyld: /usr/sbin/httpd Undefined symbols:
_CopyCStringToPascal
[Wed Jul 28 17:18:54 2004] [notice] child pid 850 exit signal Trace/BPT trap (5)
dyld: /usr/sbin/httpd Undefined symbols:
_CopyCStringToPascal
[Wed Jul 28 17:18:55 2004] [notice] child pid 869 exit signal Trace/BPT trap (5)

Soooooooo, that's where I am right now. I'm not at all sure, but I'm guessing there are still some linking problems. If you have a successful PHP5 build running on your box, you might want to try the PDFlib (PECL) install I did above and see if it works.

Let me know!

-fred
 
I just saw where I left out some important information...

When installing the PECL package...

##PECL install
sh-2.05b# pear install pecl/pdflib-2.0.1.tgz

##you will be asked for pdflib source
sh-2.05b# path to pdflib installation? [autodetect] : /Users/fwunder/Documents/php_install/bind/c

Sorry...

-fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top