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:
export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
ldconfig
It is also possible to correct this error by adding symbolic links to the library files.
3. Library files missing
This error can also happen due to related libraries for FFmpeg missing. Installing the ‘ffmpeg-devel’ module will install all the required libraries for FFmpeg.
4. Configuration errors in php.ini
Improper settings in the php.ini file can cause the FFmpeg module of PHP to show errors. So its important to verify that the settings in the php.ini file, say ‘/usr/local/lib/php.ini’, are correct.
Make sure that the FFmpeg module is added correctly in the php.ini.
[ffmpeg] extension=ffmpeg.so
Also confirm that the extension_dir in php.ini is set correctly, which should ideally be ” ” (empty).
extension_dir = " "
Once the settings are corrected, restart apache. You can confirm that FFmpeg is now enabled with php, using a phpinfo() file.
In short..
Here we discussed some of the basic reasons why FFmpeg errors can happen and what are the checks to be performed to fix the error.
During our support experience, we have also noticed that other issues like dependency errors during install, module added twice, wrongly set paths, extension directory, etc., cause FFmpeg errors.
Bobcares engineers debug server errors using a step-by-step approach, ruling out all possible causes, in the order of its priority and probability.
This helps us pinpoint the actual issue and come up with a permanent solution for the errors. If you’d like to know how to fix you server errors, we’d be happy to talk to you.
How can I solve this problem?
pls help me.
Hello,
We can help you with the FFmpeg error. If you still have errors and need help, we’ll be happy to talk to you on chat (click on the icon at right-bottom).
I have USBServr v.10, its portable version for Win. Can You show me step by step how install ffmpeg? thnks.
Hello,
Please contact our support team via live chat(click on the icon at right-bottom).