PHPmotion 环境搭建(FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool + LAME MP3 Encoder + Libog)
原文地址:http://linux.chinaunix.net/bbs/viewthread.php?tid=917564
[PHPMOTION_PHP5,Video Share Enterprise]
在网上的一个视频分享整站程序,需要上边的环境才能正常运行.最近我正好做了这个环境.所以记录了一个文档,方便大家参考.
安装简介:
请先准备及安装下列需要
1.) MySQL (version 4 or higher)
2.) PHP (version 4.2.3 or higher)
3.) FFmpeg (http://ffmpeg.mplayerhq.hu)
4.) FFmpeg-PHP (http://ffmpeg-php.sourceforge.net)
5.) Mplayer + Mencoder (http://www.mplayerhq.hu/design7/dload.html )
6.) flv2tool (http://inlet-media.de/flvtool2)
7.) LAME MP3 Encoder
8.) Libogg + Libvorbis (http://www.xiph.org/downloads)
上传后运行http://**/install/
安装完成后修改config.php里
$config[‘ffmpeg’] = "/usr/local/bin/ffmpeg"; // FFmpeg path
$config[‘mplayer’] = ‘/usr/local/bin/mplayer’; // Mplayer path
$config[‘mencoder’] = ‘/usr/local/bin/mencoder’; // Mencoder path
$config[‘metainject’] = ‘/usr/local/bin/flvtool2’; // Path where the flvtool2 is installed
改成你实际环境.
—————————————————————————————–
Author : ecore
Website: http://ecore.ishacker.org
Date : 2007-12-24
1.
[root@fc8 ~]# wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz
2.
[root@fc8 ~]# wget http://cn2.php.net/distributions/php-5.2.5.tar.gz
3.
[root@fc8 ~]# wget http://ftp.plusline.de/mysql/Dow … mysql-5.0.51.tar.gz
4.
[root@fc8 ~]# svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
5.
[root@fc8 ~]# wget http://jaist.dl.sourceforge.net/ … mpeg-php-0.5.1.tbz2
6.
[root@fc8 ~]# wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
7.
[root@fc8 ~]# wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
8.
[root@fc8 ~]# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
9.
[root@fc8 ~]# wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
10.
[root@fc8 ~]# wget http://www1.mplayerhq.hu/MPlayer … al-20071007.tar.bz2
11.
[root@fc8 ~]# wget http://www.mplayerhq.hu/MPlayer/ … cs-20040703.tar.bz2
12.
[root@fc8 ~]# wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
下载了所有要用到的包.接着我们来编绎安装.
———————————————————————————-
第一步安装,mysql
[root@fc8 ~]# groupadd mysql
[root@fc8 ~]# useradd -g mysql mysql
[root@fc8 ~]# tar -zxvf mysql-5.0.51.tar.gz
[root@fc8 ~]# cd mysql-5.0.51
[root@fc8 mysql-5.0.51]# ./configure –prefix=/usr/local/mysql
[root@fc8 mysql-5.0.51]# make;make install
[root@fc8 ~]# cp support-files/my-medium.cnf /etc/my.cnf
[root@fc8 ~]# cd /usr/local/mysql
[root@fc8 ~]# bin/mysql_install_db –user=mysql
[root@fc8 ~]# chown -R root .
[root@fc8 ~]# chown -R mysql var
[root@fc8 ~]# chgrp -R mysql .
[root@fc8 ~]# bin/mysqld_safe –user=mysql &
[root@fc8 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51-log Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show datebase;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘datebase’ at line 1
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.00 sec)
mysql> exit
Bye
mysql到此安坟完毕.
————————————————————————————————-
第二步安装apache.
[root@fc8 ~]# tar -zxvf httpd-2.2.6.tar.gz
[root@fc8 ~]# cd httpd-2.2.6
[root@fc8 httpd-2.2.6]# ./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite
[root@fc8 httpd-2.2.6]# make;make install
[root@fc8 apache2]# /usr/local/apache2/bin/apachectl start
[root@fc8 apache2]# netstat -anp|grep httpd
tcp 0 0 :::80 ::: LISTEN 19294/httpd
[root@fc8 apache2]#
apache完装完毕.
————————————————————————————————–
安装flvtool
[root@fc8 flvtool2_1.0.5_rc6]# yum install ruby
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb config
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb setup
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb install
安装lame
[root@fc8 ~]# tar -zxvf lame-3.97.tar.gz
[root@fc8 ~]# cd lame-3.97
[root@fc8 lame-3.97]# ./configure
[root@fc8 lame-3.97]#make;make install
安装libogg
[root@fc8 software]# tar -zxvf libogg-1.1.3.tar.gz
[root@fc8 software]# cd libogg-1.1.3
[root@fc8 software]# ./configure;make;make install
安装libvorbis
[root@fc8 ~]# tar -zxvf libvorbis-1.2.0.tar.gz
[root@fc8 ~]# cd libvorbis-1.2.0
[root@fc8 libvorbis-1.2.0]#./configure;make;make install
安装ffmpeg
[root@fc8 software]# cd ffmpeg
[root@fc8 ffmpeg]# ./configure –enable-shared
[root@fc8 ffmpeg]# make;make install
安装mplayer
[root@fc8 ~]# mkdir -p /usr/local/lib/codes
[root@fc8 ~]# mkdir -p /usr/local/lib/win32codcs
[root@fc8 ~]# tar -jxvf essential-20071007.tar.bz2
[root@fc8 ~]# cp -rf essential-20071007/* /usr/local/lib/codes/
[root@fc8 ~]# tar -jxvf win32codecs-20040703.tar.bz2
[root@fc8 software]# cp -rf win32codecs-20040703/* /usr/local/lib/win32codcs/
[root@fc8 ~]# tar -jxvf MPlayer-1.0rc2.tar.bz2
[root@fc8 MPlayer-1.0rc2]# ./configure –prefix=/usr/local/mplayer –enable-gui –enable-freetype –codecsdir=/usr/local/lib/codes –win32codecsdir=/usr/local/lib/win32codcs
[root@fc8 MPlayer-1.0rc2]# make;make install
安装ffmpeg-php.X.XX.tar.gz
1. Unpack the archive
tar -xjf ffmpeg-php.X.XX.tar.gz
2. cd into the ffmpeg extension directory
cd ffmpeg-php.X.XX/
3. Run phpize (included with your php install) to build configuration files
phpize
//这里要用到phpize程序,机子里可能没有,没关系先编绎一个出来,然后用完再删除.
4. Configure and build
./configure && make
5. Install the shared extension
make install (as root)
6. Unpack the archive and copy the ffmpeg extension directory into your the php
sources extensions directory
cp /usr/local/bin/ffmpeg /path/to/php_sources/ext
cp /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /path/to/php_sources/ext
7. Run autoconf to rebuild the php configure script and add the –with-ffmpeg
option
cd /path/to/php_sources
autoconf
8. 第三步安装php.(使用最新版apache+php整合时,有可能会出现问题,这个时候换低版本的测试.)
[root@fc8 ~]# tar -zxvf php-5.2.4.tar.gz
[root@fc8 php-5.2.4]# cd php-5.2.4
[root@fc8 php-5.2.4]# ./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql \
–with-config-file-path=/usr/local/php5/etc –with-ffmpeg=yes
[root@fc8 php-5.2.4]# make;make test;make install
[root@fc8 php-5.2.4]# cp php.ini-dist /usr/local/php5/etc/php.ini
安装完毕后,会在apache2的moudle目录下生成一个php*.so文件.
检查httpd.conf文件是否自动加入php相关配置。如果没有手工加入.
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .php4 .php5
AddType applicatoin/x-httpd-php-source .phps
然后在apache的htdocs目录下,写一个test.php文件内容如下:
<?
phpinfo();
?>
重启apache.然后访问http://ip/test.php
——————————————————————————————-
extension = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
把这面这一句加入php.ini
把ffmpeg-php-0.5.1目录下的
test_ffmpeg.php
tests目录都cp到apache的htdocs下边.重启apache测试.
http://192.168.0.2/test_ffmpeg.php
—————————————————————————————–
将论论上传,然后运行安装程序.
抱歉,暂停评论。