flomei
flomei

Reputation: 880

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:

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?

Upvotes: 0

Views: 1947

Answers (2)

flomei
flomei

Reputation: 880

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.

Upvotes: 1

Rainer
Rainer

Reputation: 2185

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.

Upvotes: 1

Related Questions