PDFTron.so PHP dynamic loading error

Hi all,

I get the following error when trying to execute a php script from cli as a non root user:

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20131226/PDFNetPHP.so’ - libPDFNetC.so: cannot open shared object file: No such file or directory in Unknown on line 0

My OS is a vagrant with Ubuntu 14.04 lts, php version is 5.6.8-1 . I am also using apache but this is not used because I am using the cli version.

I tried assigning persmissions 777 to /usr/lib/php5/20131226/PDFNetPHP.so but the error persisted so it makes me think that is not an error of permission (at least not totally).
Maybe I have to export a path as in https://groups.google.com/forum/#!searchin/pdfnet-sdk/ibPDFNetC.so$3A$20cannot$20open$20shared$20object$20file/pdfnet-sdk/WY_zF_d-VF0/n_JDibKSMLUJ.
I tried to export that path but it didn’t work for me/

Thanks,
Julio Sarachaga

Hi Julio:

Can you please check your php.ini (in Ubuntu it will most likely be at /etc/php/php.ini)? Can you please verify that your extension settings are correct - e.g. all the entries listed as “extension=/some/path/to/extension” are valid.

Best Regards,
Vincent Ycasas
vycasas@pdftron.com

Hi Vincent,

That is not the problem, I have just checked the php.ini and changed the extension and it didn’t work.

Regards,
Julio

You will also need to make sure that all other entries are valid in the php.ini file. For example:

extension=/usr/lib/libPDFNetC.so
extension=

will not work because one of the extension has an empty entry. If one of the extensions are also pointing to a non-existent file, then you can possibly get the error you mentioned.

The PDFNetWrappers GitHub page has been updated, so that calling

sudo make install

will now place the PDFNetPHP.so into the PHP extensions directory.

This is done by calling

php-config --extension-dir

To get the path.

The PDFNetPHP.so file needs to be in the folder pointed to by ‘php-config --extension-dir’. It appears that this is not the case.

The other two files, PDFNetPHP.php and libPDFNetC.so, should be in the folder indicated by the LD_LIBRARY_PATH environment variable. In our samples this variable is set by the RunTest.sh file.

Summary:

PDFNetPHP.so : php-config --extension-dir PDFNetPHP.php : LD_LIBRARY_PATH libPDFNetC.so : LD_LIBRARY_PATH

@Ryan Its 2021 now.

Facing the same issue :slight_smile: Not sure of where the LD_LIBRARY_PATH points to. Should this be something created by ourselves?

Thanks!