很久没有更新博客了,说来惭愧啊,这几个月都在上课,学的东西还是蛮多的,马上就上第三期课程了,没有底啊,都上了很久了从去年的10月份开始到今天才上了到第二期,比较杯具,工作依旧没有着落的样子(广告下:我在找工作,有意者请联系我给我发邮件吧,upfont@msn.com,限上海地区),只怪自己学历不够高,技术不够好,人品比较差.ok 不废话了.开始我们的phpmotion之旅.
phpmotion 是一个视频分享整站程序,类似优酷这类的吧,这个是他的demo站==> 点我进入.
这是一个Ts( Thinksns)的群友发出来的站,说能有中文版的话应该会比较不错,然后我就当一下吃螃蟹的人,去他们的phpmotion的官方下了一个包看看,大概性的看了下,他已经留好了翻译的接口,只要按照他的文件翻译就可以了,可是这个杯具的事情发生了,这个phpmotion,不是一个普通的cms,他需要支持的东西比较多,看了下他们wiki看来下服务器需求如下:
  • PHP 4.3 and above (including support of CLI)
  • MySQL database server
  • LAME MP3 Encoder
  • Libogg + Libvorbis
  • Mencoder and also Mplayer
  • FFMpeg-PHP
  • GD Library 2 or higher
  • CGI-BIN
  • Be able to run background processes
唉~看来比较悲剧,要的是linux 系统,算了,在家休息也不能闲着,复习下linux的命令也不错,接着gg了一阵发现一篇很有见地的文章.《 FFmpeg, FFmpeg-PHP, Lame, Libogg, Libvorbis, FLVtool2, Mplayer, Mencoder, AMR Installation》 是edebian的,正好我有ubuntu的服务器版,核心差不多可以试下 哈哈,接着开始了命令狂打状态(多为复制).中间有比较多的错误,要注意下.
准备工作,这是必须要做的,不做无法进行一下几步(切记!)
sudo su  //切换到root
 apt-get update
 apt-get upgrade
apt-get install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential unzip
 ///安装所需要的库和部分软件
接着是下载我们需要的文件
把下载下来的文件解压出来
tar zxvf lame-3.97.tar.gz
 tar zxvf libogg-1.1.3.tar.gz
 tar zxvf libvorbis-1.2.0.tar.gz
 tar zxvf flvtool2-1.0.6.tgz
 tar zxvf ffmpeg-20081129.tar.gz
 tar zxvf mplayer-checkout-snapshot.tar.bz2
 tar jxvf essential-20071007.tar.bz2
 bzip2 -cd amrnb-7.0.0.2.tar.bz2 | tar xvf -
 bzip2 -cd amrwb-7.0.0.3.tar.bz2 | tar xvf -
 tar zxvf libtheora-1.0beta3.tar.gz
一个编码库
mkdir /usr/local/lib/codecs/
      安装Ruby on Rails, subversion & ncurses
apt-get install subversion ruby libcurses-ruby
从svn上获得ffmpeg-php(之前我是用压缩包,但是我写这个文的时候那个下载地址找不到了,用svn也是一样的效果,除非有不兼容的情况,上帝保佑)
//svn checkout https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php 这2句 我不太肯定
svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php cd /usr/local/src/ffmpeg-php
//没有目录就mkdir一个吧 eg:mkdir ffmpeg-php svn update
复制mplayer编码库文件
mkdir /usr/local/lib/codecs
 mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
一个临时目录
mkdir /usr/local/src/tmp
 chmod 777 /usr/local/src/tmp
 export TMPDIR=/usr/local/src/tmp
安装 lame
cd /usr/local/src/lame-3.97
./configure && make && make install
安装 libogg
cd /usr/local/src/libogg-1.1.3
./configure && make && make install
安装 libvorbis
cd /usr/local/src/libvorbis-1.2.0
./configure && make && make install
如果出现
/*********************************这里是分隔符**************************/
出错提示: *** Could not run Ogg test program, checking why... *** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding Ogg or finding the wrong *** version of Ogg. If it is not finding Ogg, you'll need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH configure: error: must have Ogg installed!
解决:
# vi /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/user/local/lib
# ldconfig –v
/*************************这里是分隔符**************************/
我就在这里卡了很久没弄明白,然后突然看到一个文=>>>>>>>>

安装flvtool2
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
 ruby setup.rb setup
 ruby setup.rb install
安装mplayer & mencoder
cd /usr/local/src/mplayer
./configure --enable-jpeg
 make && make install
安装 AMR (for 3gp conversion)
cd /usr/local/src/amrnb-7.0.0.2
./configure && make && make install
cd /usr/local/src/amrwb-7.0.0.3
./configure && make && make install
安装 libtheora (for ogg video encoding)
cd /usr/local/src/libtheora-1.0beta3
./configure && make && make install
安装ffmpeg
cd /usr/local/src/ffmpeg-20081129
./configure --prefix=/usr/local --enable-memalign-hack --enable-libvorbis --disable-mmx --enable-shared
make && make install
ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
ln -s /usr/local/lib/libavcodec.so.52 /usr/lib/libavcodec.so.52
 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
 ln -s /usr/local/lib/libamrnb.so.3 /usr/lib/libamrnb.so.3
ln -s /usr/local/lib/libamrwb.so.3 /usr/lib/libamrwb.so.3
//用ln添加硬链接
安装ffmpeg-php
cd /usr/local/src/ffmpeg-php-0.5.0/
phpize
 ./configure && make make install
修改php.ini
vim /etc/php5/apache2/php.ini
 extension=ffmpeg.so (add this line to the end of the file)
重启apache2
/etc/init.d/apache2 force-reload
到这里大环境已经配置完成了~也花了一个下午才写好~悲剧啊 partTwo就是安装phpmotion 了,安装的时候还会有一个很bt的问题等着我们呢待续