# Building PHP With pdflib Support - [SOLVED]

## WhimpyPeon

I have a Intranet web server that I recently upgraded php on.  It had been a while and I can't say what the previous version of php was.  The current version is dev-php/php-4.4.0.  With the upgrade I lost pdf creation capability through pdflib.  I checked the phpinfo and found that php was built without pdflib even though I have pdflib in my use flags.  It appears as though building --with-pdflib is no longer an option.

Output of emerge -pv php is:

```

[ebuild   R   ] dev-php/php-4.4.0  +X +berkdb +crypt +curl -debug -doc -fdftk -firebird -flash -freetds +gd -gd-external +gdbm -gmp -hardenedphp -imap -informix +ipv6 +java +jpeg -kerberos -ldap -mcal -memlimit +mssql +mysql +ncurses +nls -oci8 +odbc +pam +png +postgres +readline -snmp +spell +ssl +tiff +truetype +xml2 -yaz 0 kB

```

Is there a new way of doing this so I have pdf support in php?

I really don't want to use a new package because I have several php pages that are already written to produce some forms through pdflib.

Thanks in advance for any help.Last edited by WhimpyPeon on Tue Sep 13, 2005 12:20 pm; edited 1 time in total

----------

## WhimpyPeon

OK I did some reading on the PHP web site and it looks like after version 4.3.9 you have to use PECL-pdflib.

I emerged PECL-pdflib and it looks like the extension pdflib.so was installed in:

/usr/lib/php/extensions/no-debug-non-zts-20020429/

Apache cannot load the extension and gives the following error:

 *Quote:*   

> PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20020429/pdf.so' - /usr/lib/php/extensions/no-debug-zts-20020429/pdf.so: cannot open shared object file: No such file or directory in Unknown on line 0

 

I tried to copy the pdf.so file to /usr/lib/php/extensions/no-debug-zts-20020429/.

Now apache still cannot load the extension and gives the following error:

 *Quote:*   

> PHP Warning:  Unknown(): pdf: Unable to initialize module\nModule compiled with module API=20020429, debug=0, thread-safety=0\nPHP    compiled with module API=20020429, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0

 

I really am not a guru on loading modules or setting up apache, but I am really stumped here.

Thanks for any help.Last edited by WhimpyPeon on Fri Sep 09, 2005 11:03 pm; edited 1 time in total

----------

## Redeeman

i know this isnt what you want, but may i suggest using fpdf in the future, its written in php, and its more free than pdflib afaik

----------

## WhimpyPeon

Yes, I have been looking at fpdf and it actually looks much easier than pdflib.  I will probably start using that in the future, but I have about a week or two of coding some complex forms into pdflib, and I really don't have the time to redo them right now.  So if possible I would like to fix the pdflib issue first and then I can convert over at my pace.

----------

## llongi

The module loading error happens becuse in the old PHP ebuilds, php was compiled without ZTS, but mod_php with, thus there is no real consistency for modules: they may work on one PHP SAPI but not on the others.

Please upgrade to dev-lang/php as your PHP provider, these are the new PHP ebuilds that support this correctly. Also unmerge PECL-pdflib, and after having emerged dev-lang/php, use dev-php4/pecl-pdflib or dev-php5/pecl-pdflib, depending on wich version of PHP you emerged.

More informations on the upgrade can be found here: https://forums.gentoo.org/viewtopic-t-377385.html

----------

## WhimpyPeon

I am trying to stick with stable and emerge shows dev-lang/php as being unstable.  I don't want to sound like a selfish crybaby, but isn't this why we stay with stable?  Things should work.  Ughhh.

----------

## llongi

 *WhimpyPeon wrote:*   

> I am trying to stick with stable and emerge shows dev-lang/php as being unstable.  I don't want to sound like a selfish crybaby, but isn't this why we stay with stable?  Things should work.  Ughhh.

 

The old generation PHP packages simply are not ready for this and will never be made ready, the new generation ones are the way to go (dev-lang/php).

It is marked as unstable simply because it's new and it's Gentoo policy to wait about a month to be sure no big bugs are in the package. Actually dev-lang/php proved itself quite stable, only some GD/Jpeg/PNG problems were reported 'till now and we're resolving them, though these aren't related to dev-lang/php as far as I could debug them but seem general for PHP 4.4.0.

Have a nice day, CHTEKK.

----------

## WhimpyPeon

Once the new php/apache setup is marked stable I will switch over to that.  For now I have started converting my forms over to fpdf.  It wasn't the solution I was looking for, but it will do.  fpdf seems a little more "open source" than pdflib anyhow.  The conversion to fpdf is going pretty fast IMHO it is much easier to work with than pdflib.

Thanks for all the help.

----------

