PHP unable to load dynamic library

215 Views Asked by At

I'm trying to install libinjection from here I'm trying to install the PHP module but I'm getting this error after make, make install, make test:

2/libinjection.so - /usr/lib/php5/20121212/libinjection.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Notice: Use of undefined constant LIBINJECTION_VERSION - assumed 'LIBINJECTION_VERSION' in /home/mohammed/libinjection/php/example.php on line 6

Using libinjection LIBINJECTION_VERSION PHP Fatal error:  Call to undefined function new_libinjection_sqli_state() in

/home/mohammed/libinjection/php/example.php on line 9

In php.ini I added extension=libinjection.so but I'm still getting the error.

Any advice?

2

There are 2 best solutions below

1
On

Based on the error message

/usr/lib/php5/20121212/libinjection.so: cannot open shared object file: No such file or directory

When you ran make install it did not install the extension to the path where PHP is looking for it.

Find where it installed the extension to, and copy libinjection.so to /usr/lib/php5/20121212 and then restart the web server (Apache, nginx etc) and try running your code again.

0
On

To build an extension in PHP, you first need to run scripts/phpize in the PHP folder,

and ./configure with a prefix to find the correct folder.

Simply using ./configure && make && make install is not enough.

chmod +x /usr/local/src/php-5.6.9/scripts/phpize
/usr/local/src/php-5.6.9/scripts/phpize

./configure --prefix /usr/local/src/php-5.6.9 \
--with-libdir=/lib/x86_64-linux-gnu \

Use ./configure --help to get available options.