Unable to load dynamic library 'php_libsodium'
In my experience, you can get the 'Unable to load dynamic library' message for a couple of different reasons:
- You have enabled a module in php.ini but PHP can't find the dll file (either it doesn't exist, or it is in the wrong directory).
- The dll file was compiled for the wrong architecture (32-bit vs 64-bit) or the wrong threading model (e.g. a thread-safe DLL being used on a non-thread-safe version of PHP).
- The dll has some dependencies that couldn't be found. For example, you may need some additional .dll files to be put in a location that PHP can find them (e.g. in the main PHP directory).
In your case, given that you indicate a difference between what PHP reports using php -m
and phinfo()
(presumably in a web page), #1 may be the cause. Extensions are looked for in the location specified by the extension_dir
setting in php.ini. If this is a relative path, then it may resolve differently in the context of the web server than it does when running from the command-line.