How to fix PHP FFmpeg error “Unable to load dynamic library ‘/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ffmpeg.so'”
Server wide errors are always a panic situation for server owners. A single server wide error can affect multiple websites in a split-second.
To maintain business credibility, its therefore crucial to fix server wide errors promptly. At Bobcares, we do this for our shared hosting customers, with our technical support services.
Recently we were contacted by a server owner, with this concern – “Hi, All my PHP sites show the same error:”
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ffmpeg.so' - libavformat.so.54: cannot open shared object file: No such file or directory in Unknown on line 0
What this error means?
FFmpeg is a module that helps to record, convert and stream audio and video in websites. Many websites require this PHP module for audio and video streaming.
For any PHP module to work fine, it should be compiled and configured correctly. If not, it would give errors when the websites try to use these modules.
The error shown here says that PHP is unable to load the dynamic library for FFmpeg module. This error is a server wide one and can affect all websites using this module.
How to debug this error?
FFmpeg error can happen in PHP sites if the module is not properly installed or if there are any configuration issues.
Today we’ll see which all factors can trigger this error and how to fix them one by one.
1. FFmpeg module is not properly installed
The first step is to check that the FFmpeg module is properly installed in the server. The command ‘which ffmpeg’ helps to know if its installed.
If the module is not installed, you can install it using:
yum install ffmpeg ffmpeg-devel
2. The path to the library is wrong
By default, all required libraries for FFmpeg would be installed under /usr/local/lib/ directory. But if the FFmpeg binary looks in a different path, these libraries would not be found.
Using the command
'ldd which ffmpeg', it is possible to know the path to the library to which ffmpeg binary is linked to.
To make ffmpeg check the libraries in the correct path, do the following steps:
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
It is also possible to correct this error by adding symbolic links to the library files.
Bobcares provides Outsourced Hosting Support for online businesses. Our services include Outsourced Web Hosting Support, Outsourced Server Support, Outsourced Help Desk Support, Outsource Live Chat Support and Phone Support Services.