user5806607
user5806607

Reputation: 175

PHP7.0 - unable to load dynamic library oci8.so (Ubuntu)

After following the install instructions for oracle instant client, php is not able to load the oci8 extension.
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst

I am getting an error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/oci8.so' - libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0

I have verified both oci8.so and libmql1.so locations.

Am I missing something?

Upvotes: 0

Views: 18077

Answers (5)

Anand Mane
Anand Mane

Reputation: 11

After wasting entire day for this small problem finally I came with this solution. Sorry guys I am not champion is PHP but somehow I manage. In my system I have CentOS 7 and PHP 7.4.XX. I changed my LD_LIBRARY_PATH, I have restarted my httpd service and checked phpinfo in browser (http://localhost/info.php), Last I restared php-fpm service ........... and it's work for me.

Thanking you, Anand

Upvotes: 0

Kasia Kasia
Kasia Kasia

Reputation: 21

Or:

export LD_LIBRARY_PATH=/usr/local/instantclient_12_1/

I had the same problem, it works for me.

Upvotes: 0

Tai Li
Tai Li

Reputation: 51

What I did was completely remove any installations of PHP and reinstall the version that I need.

sudo apt-get purge 'php*'

Source: https://askubuntu.com/a/59889/226518

Upvotes: 0

grondon
grondon

Reputation: 161

I solved adding the following to /etc/environment:

LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

I followed this tutorial: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703

Upvotes: 0

Gopal Sharma
Gopal Sharma

Reputation: 59

I'm using Ubuntu 16.04 and php version 7.1

There are few directories in /usr/lib/php/ for example

20131226 for php5.6

20160303 for php7.1

so problem with me that, the oci8 extension got installed on the wrong ( a user lib folder for php7.2) so I had to remove the php 7.2 completly

sudo apt-get purge php7.2-common

then I had uninstall the oci8 by running following command

sudo pecl uninstall oci8

and install again by running the following command

sudo pecl install oci8

To check the configuration loaded you do

php-config --extension-dir

And make sure that all extension are installed in the correct extension directory.

Make changes in the /etc/php/7.1/apache2/php.ini and /etc/php/7.1/cli/php.ini

Check by running phpinfo(); You must see this, ignore the cli if that stills gives you same error as your web shows the extension is getting loaded.

enter image description here

Upvotes: 1

Related Questions