skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    Being not a good engineer today, I did several things at once, so I can't tell what exactly worked out in the end. Will write down my steps nevertheless, as it works now.

    • I double checked the configuration file paths and files through php -i and a phpinfo(); to see the differences between CLI and web frontend.
    • I removed the extension=php_pdflib from both php.ini files
    • I moved the php_pdflib.so from the extension directory one level up, it now lives in /usr/lib/php directly
    • I also renamed it to phplib.so (but that was more to break things on purpose and see what happens
    • I created a 30-pdflib.ini file in /etc/php/7.3/fpm/conf.d and wrote only extension=/usr/lib/php/pdflib.so in it
    • Added that line to /etc/php/7.3/cli/php.ini to see if there's a difference
    • I tried restarting Apache2 several times, but phpinfo() did not show any changes for the loaded configuration files or modules
    • I did a sudo reboot
    • Checked again and now PDFlib is loaded for CLI as well as for web

    So, not sure if a hard reboot really fixed this, but it seems to me like that. Maybe this helps someone else.


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search