php 如何在 WampServer 2.0 (Windows XP) 中安装 FFMpeg

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1172916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 01:20:16  来源:igfitidea点击:

How to install FFMpeg in WampServer 2.0 (Windows XP)

phpffmpegvideo-streamingwampserver

提问by Richard Knop

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.

我需要在我的本地主机上安装 ffmpeg PHP 扩展,这样我就可以测试我的几个脚本,但是我在弄清楚如何做到这一点时遇到了麻烦。

I have WampServer 2.0 with PHP 5.2.9-2, my OS is Windows XP. Please somebody give me step by step instructions.

我有 WampServer 2.0 和 PHP 5.2.9-2,我的操作系统是 Windows XP。请有人给我一步一步的指示。

I have found some Windows builds here: http://sourceforge.net/projects/ffmpeg-php/files/

我在这里找到了一些 Windows 版本: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:

到目前为止我做了什么:

  1. Download ffmpeg_new
  2. Copy php_ffmpeg.dll from the php5 folder to the C:\wamp\bin\php\php5.2.9-2\ext
  3. Copy files from common to the windows/system32 folder
  4. Add extension=php_ffmpeg.dll to php.ini file
  5. Restarted all services (Apache, PHP...)
  1. 下载 ffmpeg_new
  2. 将php_ffmpeg.dll从php5文件夹复制到C:\wamp\bin\php\php5.2.9-2\ext
  3. 将文件从 common 复制到 windows/system32 文件夹
  4. 将 extension=php_ffmpeg.dll 添加到 php.ini 文件
  5. 重新启动所有服务(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.

另外,我也从上面得到了例外。

回答by Gajendra Bang

add this line to your php.ini file

将此行添加到您的 php.ini 文件中

[PHP_ffmpeg]
extension=php_ffmpeg.dll

回答by ganjar

http://sergey89.ru/files/ffmpeg-php-win32-all.zip

http://sergey89.ru/files/ffmpeg-php-win32-all.zip

  1. unpack ffmpeg-php-win32-all.zip
  2. Copying php_ffmpeg.dll to the \wamp\php4\extension\ (for php5 it's \wamp\bin\php\ext)
  3. Copying avcodec.dll & avformat.dll and any other in package to the \windows\system32\
  4. Editing \wamp\apache\apache2.xx\bin\php.ini - adding line extension=php_ffmpeg.dll
  5. Restarting Apache.
  1. 解压 ffmpeg-php-win32-all.zip
  2. 将 php_ffmpeg.dll 复制到 \wamp\php4\extension\(对于 php5,它是 \wamp\bin\php\ext)
  3. 将 avcodec.dll 和 avformat.dll 以及任何其他包复制到 \windows\system32\
  4. 编辑 \wamp\apache\apache2.xx\bin\php.ini - 添加行扩展名=php_ffmpeg.dll
  5. 重新启动阿帕奇。

回答by shen

Editing \wamp\apache\apache2.xx\bin\php.ini- adding line extension=php_ffmpeg.dll

编辑\wamp\apache\apache2.xx\bin\php.ini- 添加行extension=php_ffmpeg.dll

INSTEAD OF

代替

Editing \wamp\bin\php\php5.2.9\php.ini- adding line extension=php_ffmpeg.dll

编辑\wamp\bin\php\php5.2.9\php.ini- 添加行extension=php_ffmpeg.dll

回答by Payal

; 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_dlis turned off. After that you will not get error.

这些是php.ini. 确保enable_dl已关闭。之后你就不会出错了。

回答by DDRBoxman

  1. Download ffmpeg_new
  2. Copy php_ffmpeg.dll from the php5 folder to the wamp/php/ext folder
  3. Copy files from common to the windows/system32 folder
  1. 下载 ffmpeg_new
  2. 将php_ffmpeg.dll从php5文件夹复制到wamp/php/ext文件夹
  3. 将文件从 common 复制到 windows/system32 文件夹

回答by Ian Selby

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.

看起来问题不是出在 ffmpeg 上……警告是关于 dl 函数的使用。多线程 PHP 不支持动态加载任何 PHP 扩展,因此您需要确保它的 .dll 文件放置在其余 php 模块所在的任何位置。

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).

您真正需要弄清楚的是,尽管您的 php.ini 中有“extension=php_ffmpeg.dll”指令,但为什么扩展程序没有加载。通常您可以在 apache 错误日志中看到任何启动错误(例如 PHP 说它无法加载库)。另外,您是否查看了 phpinfo() 并验证了 ffmpeg 不存在(不应该是因为 extension_loaded 返回 false),但也许它以不同的名称存在(我想您也可以使用 get_loaded_extensions()) .

回答by Muhammad Hasnain

MirKo is correct but i'll like to add that

MirKo 是正确的,但我想补充一点

after

  1. Download compiled dlls from here: http://sergey89.ru/files/ffmpeg-php-win32-all.zip
  2. Extract and put php_ffmpeg.dll to you php ext folder
  3. Put the rest of dlls to you windows/system32 folder
  4. 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)
  1. 从这里下载编译的 dll:http://sergey89.ru/files/ffmpeg-php-win32-all.zip
  2. 将 php_ffmpeg.dll 解压到你的 php ext 文件夹中
  3. 将其余的 dll 放入 windows/system32 文件夹
  4. 重新启动 apache 并运行 phpinfo() - 您应该会看到 ffmpeg 扩展名(顺便说一句,如果您要查找错误 wamp->php->php 错误日志,则必须检查 php 而不是 apache 错误日志)

there is another step

还有一步

  1. Open php.ini file and find ; extension=msql.dll
    add after it
    extension=php_ffmpeg.dll
  1. 打开 php.ini 文件并找到 ;extension=msql.dll
    在它后面添加
    extension=php_ffmpeg.dll