Search code examples
phpapachepdflib

PDFLib installed but not available in code or visible through phpinfo()


I think I did quite a good job on installing PDFlib on a system (Ubuntu 18.04) but something's not totally right yet. What I did so far:

  • Followed the instructions here: https://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf
  • Downloaded the correct php_pdflib.so file and placed it in the extension directory I got through phpinfo()
  • Added extension=php_pdflib.so in my php.ini
  • Ran a sudo systemctl restart apache2 to restart Apache and reload extensions
  • Checked with php -i | grep PDF whether the binary was loaded or not, result seems positive

    PDFlib  
    PDFlib Support => enabled  
    PDFlib GmbH Binary-Version => 9.2.0 
    

Now, when I run phpinfo(); from the web side through a file, there is no mention of PDFlib at all. When I run it through CLI, everything seems to be okay.

I also tried creating a new PDFlib() instance through CLI and web. CLI works, web doesn't.

Did I miss something in the install process?


Solution

  • I also tried creating a new PDFlib() instance through CLI and web. CLI works, web doesn't.

    this is a typical situation. The PHP CLI and the PHP within the web server could have different configuration. So please check the extension_dir as well which the php.ini which was loaded in your web server phpinfo() output. Then you have do the the same configuration. Please check as well the PHP/Webserver log file for any error messages. Maybe it might be NTS/TS (threading) issue as well, but this will be mentioned in the error message.