I need to install the ffmpeg PHP extension on my localhost so I can test few of my scripts but I am having troubles figuring out how to do that.
I have WampServer 2.0 with PHP 5.2.9-2, my OS is Windows XP. Please somebody give me step by step instructions.
I have found some Windows builds here: http://sourceforge.net/projects/ffmpeg-php/files/
But I don't know which one to download and what to do with files.
EDITED:
What I have done so far:
- Download ffmpeg_new
- Copy php_ffmpeg.dll from the php5 folder to the C:\wamp\bin\php\php5.2.9-2\ext
- Copy files from common to the windows/system32 folder
- Add extension=php_ffmpeg.dll to php.ini file
- Restarted all services (Apache, PHP...)
I am gettings an error after using this code:
$extension = 'ffmpeg';
$extension_soname = 'php_ffmpeg.dll';
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
// load extension
if(false === extension_loaded($extension)) {
if (false === dl($extension_soname))
throw new Exception("Can't load extension $extension_fullname\n");
}
The error:
Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=ffmpeg.dll in your php.ini in C:\wamp\www\hunnyhive\application\modules\default\controllers\MyAccountController.php on line 314
Plus I also get the exception from above.
add this line to your php.ini file
[PHP_ffmpeg]
extension=php_ffmpeg.dll
http://sergey89.ru/files/ffmpeg-php-win32-all.zip
- unpack ffmpeg-php-win32-all.zip
- Copying php_ffmpeg.dll to the \wamp\php4\extension\ (for php5 it's
\wamp\bin\php\ext)
- Copying avcodec.dll & avformat.dll and any other in package to the \windows\system32\
- Editing \wamp\apache\apache2.xx\bin\php.ini - adding line extension=php_ffmpeg.dll
- Restarting Apache.
Doesn't look like the problem is with ffmpeg... the warning is about the use of the dl function. Multi-threaded PHP does not support dynamic loading of any PHP extension, so you'll need to make sure the .dll file for it is placed wherever the rest of your php modules live.
What you really need to figure out is why the extension doesn't load despite the fact you've got the "extension=php_ffmpeg.dll" directive in your php.ini. Usually you can see any startup errors in your apache error log (such as PHP saying it can't load a library). Also, have you taken a look at a phpinfo() and verified ffmpeg isn't present (shouldn't be since the extension_loaded returns false), but perhaps it's there under a different name (you could also use get_loaded_extensions() I suppose).
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = Off
These are the lines in php.ini
. Make sure that enable_dl
is turned off. After that you will not get error.
Editing \wamp\apache\apache2.xx\bin\php.ini
- adding line extension=php_ffmpeg.dll
INSTEAD OF
Editing \wamp\bin\php\php5.2.9\php.ini
- adding line extension=php_ffmpeg.dll
MirKo is correct but i'll like to add that
after
- Download compiled dlls from here: http://sergey89.ru/files/ffmpeg-php-win32-all.zip
- Extract and put php_ffmpeg.dll to you php ext folder
- Put the rest of dlls to you windows/system32 folder
- Restart apache and run phpinfo() - you should see the ffmpeg extension (btw you have to check php not apache error log if you are looking for errors wamp->php->php error log)
there is another step
- Open php.ini file and find
; extension=msql.dll
add after it
extension=php_ffmpeg.dll