147

I run a PHP script and get this error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0

What does that mean?

0

20 Answers 20

62

It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin

Unfortunately that file or path doesn't exist or the permissions are incorrect.

  1. Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
  2. Either correct the path to the file or comment out the corresponding line.
Sign up to request clarification or add additional context in comments.

7 Comments

So I'm getting this error too, but my site still works - thats the strangest part. For this type of error, I'd assume that php would crash right from the start. Instead I get my page, but my logger is logging this error. Weird huh?
In the php.ini (/etc/php.ini in my case) I commented out the line extension=php_pdo_mysql.dll and restarted Apache which solved my problem and got rid of the warnings. (Mac, Maverick)
Either correct the path what path are we talking about ?
3. or install the missing expected extension
@BT It still works because this is a Warning, not an error or fatal, and will only trigger when attempting to call those libraries in code.
|
54

If you're on Linux, you can find all loaded configuration files by typing this in shell:

php -r "print phpinfo();" | grep ".ini"

UPDATE: As mentioned in comments, this can be even more accurate:

php -i | grep ini

3 Comments

what about php --ini to list all ini files
Just keep in mind that the php command line can use different phi.ini files from php web modules. This should get you closer at least though.
I think what the answer tries to show is the already-loaded extensions in PHP from other files. What I noticed was that the list from the command of the answer contained extensions that I was receiving the error about. If you go to your php.ini file, of which the location is shown in the above command under Loaded Configuration File, you can scroll to the bottom of that file and comment out any extensions that are already loading and shown in the error. I ended up commenting out every single extension because they were already present in /php/7.4/cli/config/20-[extension].ini
34

phpStom with XAMPP

TL;DR Except from verifying that the files exist, you might need to add the drive letter to some records in your php.ini file

I suddenly started having a problem using phpStorm 7 for debugging php with xampp and xdebug. When trying to set intellij interperter to be xampps php I got a lot of the warnings like the one in the question, for example:

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

For some reason I had to add my drive letter to the records of extension_dir and browscap in the php.ini file:

extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"

to

extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"

3 Comments

This fixed it for me on Windows 10.
This fixed it for me on windows 7. Thanks a lot
Using extension_dir = "ext" works when you run from cmd, but when you run from Apache you probably need an absolute path (with drive letter etc).
18

If you just want to make the error disappear, and you don't need the extension, then by all means comment the line out in php.ini. But if you actually want to fix the problem here is some additional info.

There are various causes for this based on the exact module, but there are also some general guidelines.

  1. Open phpinfo() and look for extension_dir under the Core section. This is where your modules should be located.

For instance, /usr/lib/php/modules for Unix/Linux.

  1. If the file does in fact exist, make sure permissions are adequate.
  2. If the file does not exist, use the resources below to install it.

Installation on *nix (PEAR)
Installation of extensions on Windows

4 Comments

I'm trying to install through this pear module but when I run perl install <module> I got Can't open perl script "install": File or Directory not found
It's difficult to know the problem, check your paths and permissions.
if in a container try docker-php-ext-install <package>
That helped me to lookup this in php.ini and then see that the folder was empty.
7

Loading .dll in Linux

I've encountered this warning message while I was trying to install a php-extension via the php.ini file;

until I figured out that you cannot load .dll extensions in Linux,

but you have to comment the extensions that you want to import ;extension= ... .dll and install it correctly via sudo apt-get install php-...

note: ... is the extension name you want to enable.

1 Comment

Exactly, for me it was simply missing module installation - I was installing phpPgAdmin and what I needed to install explicitly was sudo apt install php-pgsql and php-version-specific sudo apt install php7.1-pgsql (change 7.1 to your php version)
6

php -r "echo php_ini_loaded_file();"

Will show in CLI current ini loaded file, search there for Your extension, path to it is incorrect.

Comments

5

In my case, this message started to appear when I updated the php version to 7.4.

To solve it I had to look for the php.ini files found inside the php version folder (/etc/php/7.4/apache2/ && /etc/php/7.4/cli/) checking the lines where the extensions I could see that the extensions gd2 and intl were uncommented.

Comments

4

I had this error on a number of modules when I had been running different versions of PHP side by side on my server. To sort this out, I needed to install the packages it couldn't find for that specific PHP version. So, for example, if I saw:-

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'

I would install the library for the PHP version specifically:-

sudo apt-get install php7.1-xml

And then restart Apache. Fixed it for me. You can check your version like this:-

php -v

Comments

3

Note that you can also get this error if your PHP library doesn't have the "other" directory opening permission. In my particular case, I noticed this when using php -l to syntax check a script in my text editor. This meant that since my account was called "volomike", that account didn't have permission to run the libraries that the php command relied upon.

For instance, on Ubuntu 14.04, I had PHP5 installed automatically into the path /usr/lib/php5/20121212+lfs. However, because I was working in C++ in building some shared objects, I messed around with the directory permissions and screwed things up such that non-root accounts did not have the directory execute (directory open) permissions to view /usr/lib/php5/20121212+lfs. So, I typed the following command to rectify that problem:

sudo chmod o+x /usr/lib/php5/20121212+lfs.

Now when I do php -l example.php as a non-root user, it never gives me this "Unabled to load dynamic library" problem anymore.

2 Comments

This was the exact solution for me, using Ubuntu 16.10. Make sure that you change the extension "extension" to .so when using Linux (standard config was giving me .dll)
I'm using linux mint 18 and this is still valid
2

I had the same problem on XAMPP for Windows when I try to install composer. I did php -v and php throwing error :

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

It took me a while until I realized that I need to setup my XAMPP. So I run setup_xampp.bat and php return to works like a charm.

Comments

2

I had the same problem on XAMPP for Windows10 when I try to install composer.

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

Then follow this steps

  1. just open your current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini in texteditor (like notepad++)
  2. now just find - is the current_xampp_containing_drive:\xampp exist?
  3. if not then find the "extension_dir" and get the drive name(c,d or your desired drive) like.

extension_dir="F:\xampp731\php\ext" (here finded_drive_name_from_the_file is F)

  1. again replace with finded_drive_name_from_the_file:\xampp with current_xampp_containing_drive:\xampp and save.
  2. now again start the composer installation progress, i think your problem will be solved.

Comments

2

What I did was;

1 - I first find out what version of PHP I am using thru the function phpinfo()

<?php   
    phpinfo();
?>

2 - From there you will find the location of your configuration(php.ini) file

method phpinfo() result

3 - Open that file

4 - Comment out the line similar to the image below

This might be a different value but it should be related to extension. I am no expert but this process helped me solved similar problem.

enter image description here

Comments

2

In my case I got this error because I downloaded a thread-safe version of the dll (infixed with -ts-), but my installation of php was a non-thread-safe (infixed with -nts-). Downloading the right version of the dll, exactly matching my php installation version fixed the issue.

1 Comment

To check on server thread-safe config see phpinfo() and thread-safety enabled/disabled. Had same error in reverse, downloaded nts when configured for ts.
1

After Windows 10 XAMPP now I installed LAMPP (XAMPP) on Ubuntu. Windows XAMPP had a lot less to configure compare to MAC (iOS) but now with Linux Ubuntu I had a few more since there are more going in Linux (a good thing).

I confused and activated mysqli.dll (and mysql.dll: erase "#" in /etc/php/7.2/cli/php.ini

I started to get the PHP Warning: PHP Startup: Unable to load dynamic library message related to dll. I commented out mysql(and i).dll in the same file but the message didn't go away up until I commented out " " in /opt/lampp/etc/php.ini.

Looks like XAMPP reads php.ini file from /etc/php/7.2/cli and makes modification in php.ini of /opt/lampp/etc. (;extension=php_pdo_mysql.dll after ";" restarted Apache and no more any message.

Comments

1

Uncomment extension_dir = "ext" in php.ini worked for me. I am using Windows

Comments

0

From C:\xampp\php\php.exe I got

  • Unable to load dynamic library ''
  • C:\xampp\php\ext\php_.dll (The specified module could not be found.)

I solved by commenting out
C:\xampp\php\php.ini
;extension=

Comments

0

I had the same problem when I tried to use php with sql server, when I added the sqlsrv libraries ... it gave me the error, after several days of researching there, I understood that microsoft does not support x64 in this case so what I did was install laragon x86 and use the corresponding libraries. I hope it helps with something

Comments

0

Go to system env variable and set the php ext dir path as

C:\xampp\php\ext

basically it's finding the ext directory and then locating it's file but it's unable to find the files becuase php path is set as different.

Comments

0

Look at the architecture (arm64, amd64, ...) !

I ran into this problem with pdflib for php in lando (docker DEBIAN 11) on macOS.

The problem was that my copy of php_pdflib.so was packaged for linux/amd64 but in docker I was running Debain arm64 version.

So thew solution is to use the right package for the right architecture :)

On Debian(-based) linux you can find out your architect with

dpkg --print-architecture

Also you can analyze your shared object (.so-file) with:

ldd

Comments

0

The steps I followed to resolve this Unable to load dynamic library warning issue:

  1. Copy all *.dll files: to c:\xampp\php
  2. Copy all *.dll files to c:\xampp\apache\bin (We need a second copy here for apache)

Thats it !! After adding the .dll files to my root php and apache, the warning was resolved.

N.B. Ensure the XAMPP path as per the installation directory. And don't forget to restart the server.

3 Comments

Did this solution get anything wrong ?? Don't know, why down-voted !! Even after implementing a lot more solutions, I resolved it following above solutions. Don't know, What's wrong with it !!
Likely you got downvoted because your answer only works on Windows, and the original question is for Linux. Also, copy/pasting dll files to duplicate folders is more of a shotgun solution than a correct one. Maybe it fixes the error but it's not a proper way to handle the problem in a production system.
Yes, this solution works at windows. I thought, someone using windows might be searching for the solutions of this same error. And I think, this is not worthy reason for down-voting !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.