ffmpeg.so unable to load dynamic library

jonn

Verified User
Joined
Mar 29, 2009
Messages
107
Location
Queensland, Australia.
if anyone has installed FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool + LAME MP3 Encoder + Libogg + Libvorbis + AMR on a Linux Based Server

please Im going insane this is the second day on this install, I followed about 13-20 different sites instructions, google groups, and finally it installed

BUT. and a big BUT


These are the files I used to install after many many different tries with many different versions to get it to install.
Code:
Setup the directory to use
(Wouldn’t want /root to start getting crowded, would we?)
mkdir /usr/local/src
cd /usr/local/src

Dowload the necessary files.
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://internap.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.1.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-6.0.0.1.tar.bz2

It installed I was so happy, but I think I celebrated too early.

=============////:eek::o

when trying the make test to see if it worked

[root@ns1 ffmpeg-php-0.5.1]# make test

I got errors -- it doesnt load the ffmpeg.so :mad:

Code:
[root@ns1 modules]# cd /usr/local/src/ffmpeg-php-0.5.1/
[root@ns1 ffmpeg-php-0.5.1]# make test

Build complete.
Don't forget to run 'make test'.

PHP Warning:  PHP Startup: Unable to load dynamic library './ffmpeg.so' - ./ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

now I know it's there because I see it in:
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/

and everywhere else:
ffmpeg: /usr/bin/ffmpeg /usr/local/bin/ffmpeg /usr/share/ffmpeg

Any help is greatful.
Ive looked at many websites over 2 days. And every page here on directadmin, nothing helped all are outdated by nearly 2 years or for another OS, I still get the error regardless what I try.

I tried removing ./ in extension_dir=""
I also tried extension_dir="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
in both Zend/php.ini & lib/php.ini
with & without extension=ffmpeg.so
added it in many variations, then removed the changes to php.ini's I did and tried 'make test' and again the same error with ffmpeg.so. It didnt matter what I tried.

What Am I missing. I know it's a stab in the dark asking.
The server is custombuild CLI 32bit. If that helps understand what I rambling on about.
 
Code:
# Install FFMPEG on CentOS
cd /root
echo "[dag]" > /etc/yum.repos.d/dag.repo
echo "name=Dag RPM Repository for Red Hat Enterprise Linux" >> /etc/yum.repos.d/dag.repo
echo "baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag" >> /etc/yum.repos.d/dag.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/dag.repo
echo "enabled=1" >> /etc/yum.repos.d/dag.repo

yum -y install ffmpeg ffmpeg-devel flvtool2 mencoder
wget http://internap.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2
tar -xjf ffmpeg-php-0.5.3.1.tbz2
cd ffmpeg-php-0.5.3.1/
phpize
./configure
make
make install
# Note in my php.ini file I have extension_dir = "/usr/local/lib/php/extensions" 
# so therefore I copy the ffmpeg.so to that. You need to check your own extension_dir
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /usr/local/lib/php/extensions/
echo "extension=ffmpeg.so" >> /etc/php.ini
service httpd restart
 
nah got a lot of errors.

first from yum:
Code:
  Installing: gtk2                         ####################### [62/88]
g_module_open() failed for /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so: /usr/local/lib/libpng12.so.0: undefined symbol: inflateReset
/usr/bin/gtk-query-immodules-2.0-32: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/lib/libcairo.so.2)

then after make
Code:
/bin/sh /root/ffmpeg-php-0.5.3.1/libtool --mode=compile gcc  -I. -I/root/ffmpeg-php-0.5.3.1 -DPHP_ATOM_INC -I/root/ffmpeg-php-0.5.3.1/include -I/root/ffmpeg-php-0.5.3.1/main -I/root/ffmpeg-php-0.5.3.1 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/ffmpeg  -I/usr/local/include/php -DHAVE_CONFIG_H  -g -O2 -Wall -fno-strict-aliasing   -c /root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c -o ffmpeg_frame.lo
 gcc -I. -I/root/ffmpeg-php-0.5.3.1 -DPHP_ATOM_INC -I/root/ffmpeg-php-0.5.3.1/include -I/root/ffmpeg-php-0.5.3.1/main -I/root/ffmpeg-php-0.5.3.1 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/ffmpeg -I/usr/local/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c  -fPIC -DPIC -o .libs/ffmpeg_frame.o
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function '_php_convert_frame':
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:202: warning: implicit declaration of function 'img_convert'
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function '_php_crop_frame':
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:260: warning: implicit declaration of function 'img_copy'
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function '_php_resample_frame':
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: 'ImgReSampleContext' undeclared (first use in this function)
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: (Each undeclared identifier is reported only once
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: for each function it appears in.)
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: 'img_resample_ctx' undeclared (first use in this function)
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:308: warning: implicit declaration of function 'img_resample_full_init'
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:321: warning: implicit declaration of function 'img_resample'
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:326: warning: implicit declaration of function 'img_resample_close'
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function 'zif_toGDImage':
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:448: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function 'zif_ffmpeg_frame':
/root/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:533: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1

So I looked inside the folder /root/ffmpeg-php-0.5.3.1/ to find the spelling error is still there. so I typed:
Code:
cp ffmpeg_frame.loT ffmpeg_frame.lo


Now make worked, then make install, installed okay to:
Code:
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20060613/

I did the cp ffmpeg to php.ini and tried make test and it spat out:
Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/ffmpeg.so' - modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0


No, it dont work. wont load
 
I got the ffmpeg to convert. Finally...

So for anyone else having to install FFMPEG
Use floyd example, to load only the ffmpeg stuff in the yum statement he noted:
I wish I new earlier.

My system is:
Red Hat 9
CentOS 5
CLI Custombuild
PHP 5.2.9

to make my software identify the video in /usr/local/bin/ffmpeg
I moved the ffmpeg.so to the lib directory, rebuild php restarted and wallah.
funny enough before i rebuild php it didnt load, so something in php got screwed up.

Code:
cp /root/ffmpeg-php-0.5.3.1/modules/ffmpeg.so /usr/local/lib/

I used this to test ffmpeg is working.
Code:
<html>
<head>
<title></title>
</head>
<body>
<h1>FFMPEG Video Plugin Server Test</h1>
<?
if(!isset($_GET['ffmpeg_path'])) { // show form
if(in_array('exec', explode(',', ini_get('disable_functions')))) {
// exec is disabled on this server
echo 'The php function "exec" [<a href="http://www.php.net/manual/en/function.exec.php" target="_blank">
http://www.php.net/manual/en/function.exec.php</a>] is disabled on this server.
<br><br>Please enable this function by editing the "disable_functions" variable in your php.ini file';
exit; }
$ffmpeg_path = '';
$error = false;
} else { // verify that ffmpeg is installed
$ffmpeg_path = escapeshellcmd(strip_tags($_GET['ffmpeg_path']));
$error = false;
$result = null;
exec($ffmpeg_path.' -version', $result);
if(empty($result) || !isset($result[0]) || !strstr($result[0], 'FFmpeg')) {
$error = true; } else { echo 'Your server has got all video plugin requirements.';
exit;}}
?>
Please specify the full path to your FFmpeg installation:<br>usually: /usr/local/bin/ffmpeg<br>
<form name='install_video_plugin' action='video_server_test.php' method='get'>
<input type="text" name="ffmpeg_path" class="text" size="60" value="<?=$ffmpeg_path;?>">
<? if($error) { ?>
<br><strong style="color:#ff0000">The FFmpeg installation could not be found. Try again.</strong>
<? } ?>
<br><br>
<input type="submit" value="Find FFmpeg installation">
</form>
</body>
</html>


anyway it now works, thanks to floyd and the sample install alternative. Well done.
 
Glad you got it working.

My system is:
Red Hat 9
CentOS 5

You cannot have both RedHat9 and CentOS 5

My example will probably work ok if you have not already tried it the other way. I have done this on dozens of servers now without a glitch.
 
Appreciate it, but for that one I would say a big "woops", no doubt they are two different operating systems. I clicked copy'n'paste from a textpad, didnt pay attention to the part I clicked copy. should have typed it.

Do I still get an A for effort. :p
 
i have err0r

Code:
[root@trance ~]# php -r 'phpinfo();' | grep ffmpeg
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/lib/libavcodec.so.51: undefined symbol: av_crc04C11DB7 in Unknown on line 0
[root@trance ~]#
how i can fix this


Thank you.
 
iFusion,

Did you create the library symlinks?
Code:
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

You can also try updating your shared libraries.
Code:
ldconfig -v

Good luck,
Ted
 
[root@trance ~]# ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln: creating symbolic link `/usr/lib/libavutil.so.49' to `/usr/local/lib/libavutil.so.49': File exists
[root@trance ~]# ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln: creating symbolic link `/usr/lib/libmp3lame.so.0' to `/usr/local/lib/libmp3lame.so.0': File exists
[root@trance ~]# ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
ln: creating symbolic link `/usr/lib/libavformat.so.51' to `/usr/local/lib/libavformat.so.51': File exists



hmmm...
 
iFusion,

How did you go about your install, RPMs or Source? Did you gather instructions from somewhere, if so, where? I have a crude bash script I threw together as I have performed installs on a number of Redhat based OSes... saves me loads of time. :cool: If your interested PM me.

Ted
 
Last edited:
Hello,

I have this problem:
Code:
PHP Warning:  PHP Startup: Unable to load dynamic library './/usr/local/bin/ffmpeg/ffmpeg.so' - .//usr/local/bin/ffmpeg/ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0

My system is:
VPS with Centos 5.2
PHP 5.2.10 (cli) (built: Aug 1 2009 11:00:52)

Can anybody help me?

Thank you.
 
le_ffmpeg_frame

Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0

I have this error to?
 
I solved this problem by changing the extension_dir in php.ini to the real directory.

#
#
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
I wish it would help
 
I got the ffmpeg to convert. Finally...

So for anyone else having to install FFMPEG
Use floyd example, to load only the ffmpeg stuff in the yum statement he noted:
I wish I new earlier.

My system is:
Red Hat 9
CentOS 5
CLI Custombuild
PHP 5.2.9

to make my software identify the video in /usr/local/bin/ffmpeg
I moved the ffmpeg.so to the lib directory, rebuild php restarted and wallah.
funny enough before i rebuild php it didnt load, so something in php got screwed up.

Code:
cp /root/ffmpeg-php-0.5.3.1/modules/ffmpeg.so /usr/local/lib/

I used this to test ffmpeg is working.
Code:
<html>
<head>
<title></title>
</head>
<body>
<h1>FFMPEG Video Plugin Server Test</h1>
<?
if(!isset($_GET['ffmpeg_path'])) { // show form
if(in_array('exec', explode(',', ini_get('disable_functions')))) {
// exec is disabled on this server
echo 'The php function "exec" [<a href="http://www.php.net/manual/en/function.exec.php" target="_blank">
http://www.php.net/manual/en/function.exec.php</a>] is disabled on this server.
<br><br>Please enable this function by editing the "disable_functions" variable in your php.ini file';
exit; }
$ffmpeg_path = '';
$error = false;
} else { // verify that ffmpeg is installed
$ffmpeg_path = escapeshellcmd(strip_tags($_GET['ffmpeg_path']));
$error = false;
$result = null;
exec($ffmpeg_path.' -version', $result);
if(empty($result) || !isset($result[0]) || !strstr($result[0], 'FFmpeg')) {
$error = true; } else { echo 'Your server has got all video plugin requirements.';
exit;}}
?>
Please specify the full path to your FFmpeg installation:<br>usually: /usr/local/bin/ffmpeg<br>
<form name='install_video_plugin' action='video_server_test.php' method='get'>
<input type="text" name="ffmpeg_path" class="text" size="60" value="<?=$ffmpeg_path;?>">
<? if($error) { ?>
<br><strong style="color:#ff0000">The FFmpeg installation could not be found. Try again.</strong>
<? } ?>
<br><br>
<input type="submit" value="Find FFmpeg installation">
</form>
</body>
</html>


anyway it now works, thanks to floyd and the sample install alternative. Well done.

how to know the installation got perfect ?
i've follow all the steps, but when i copy your code to my index.php ... i've this

Code:
FFMPEG Video Plugin Server Test

http://www.php.net/manual/en/function.exec.php] is disabled on this server. 

Please enable this function by editing the "disable_functions" variable in your php.ini file'; exit; } $ffmpeg_path = ''; $error = false; } else { // verify that ffmpeg is installed $ffmpeg_path = escapeshellcmd(strip_tags($_GET['ffmpeg_path'])); $error = false; $result = null; exec($ffmpeg_path.' -version', $result); if(empty($result) || !isset($result[0]) || !strstr($result[0], 'FFmpeg')) { $error = true; } else { echo 'Your server has got all video plugin requirements.'; exit;}} ?> Please specify the full path to your FFmpeg installation:
usually: /usr/local/bin/ffmpeg
 
The FFmpeg installation could not be found. Try again.
 
Back
Top