So Many people Looking Tutorial How To Develop Their Own Video streaming Server Like You tube already done. This time i’ll tell you how to make it’s happen, we’ll using FreeBSD 7.0 as OS.
Langkah pertama silahkan downlod PHPMOTION5 dari website Official PHPMOTION, atau dari link ini http://unilanet.unila.ac.id/~gigih/data/PHPMOTION-PHP5/PHPMOTION_PHP5.zip
Downlod phpshield library untuk freeBSD dialamat
http://unilanet.unila.ac.id/~gigih/data/PHPMOTION-PHP5/phpshield.5.2.fre Atau dari Official phpshieldnya langsung
Asumsi saya Anda sudah berhasil menginstall Apache 2.2 dan Mysql 5 di PC anda, dan saya tidak membahas langkah2 instalasi Apache,Mysql,PHP5, PHP5-EXTENSIONSetelah anda berhasil mendownlod source PHPMOTION silahkan ekstrak dilokasi directory html anda. Silahkan anda buka browser dan masukkan alamat
http://IP-SERVER-ANDA/PHPMOTION/
Anda pasti akan mendapati pesan error sebagai berikut
Warning: dl() [function.dl]: Temporary module name should contain only filename in /usr/hosting/blog/web/PHPMOTION/classes/config.php on line 2
PHP script /usr/hosting/blog/web/PHPMOTION/classes/config.php is protected by phpSHIELD and requires the phpSHIELD loader phpshield.5.2.fre. The phpSHIELD loader has not been installed, or is not installed correctly. Please visit the phpSHIELD php encoder site to download required loader.
Nah Kalo ada warning begini artinya anda belum mengaktifkan atau mengkonfigurasi library phpshield secara benar.
Agar warning ini tidak tampil anda perlu mengikuti langkah berikut
- PHP5 Harus diinstall dengan mode ENABLE_DEBUG = NO, silahkan uncheck Enable debug pada saat instalasi PHP5 asumsi saya anda menginstall PHP5 via port Collection jika anda mengcompile dengan mode ENABLE_DEBUG= YES, maka akan timbul warning di browser sebagai berikut
Warning: dl() [function.dl]: phpSHIELD: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613,
debug=1, thread-safety=0 These options need to match in /usr/hosting/blog/web/PHPMOTION/classes/config.php
on line 2 PHP script /usr/hosting/blog/web/PHPMOTION/classes/config.php is protected by phpSHIELD
and requires the phpSHIELD loader phpshield.5.2.fre. The phpSHIELD loader has not been installed,
or is not installed correctly. Please visit the phpSHIELD php encoder site to download required loader.
│ [X] CLI Build CLI version
│ │[X] CGI Build CGI version
│ │[X] APACHE Build Apache module
│ │[ ] DEBUG Enable debug
│ │[X] SUHOSIN Enable Suhosin protection system (not for jails)
│ │[X] MULTIBYTE Enable zend multibyte support
│ │[ ] IPV6 Enable ipv6 support
│ │[ ] MAILHEAD Enable mail header patch
│ │[X] REDIRECT Enable force-cgi-redirect support (CGI only)
│ │[ ] DISCARD Enable discard-path support (CGI only)
│ │[X] FASTCGI Enable fastcgi support (CGI only)
│ │[X] PATHINFO Enable path-info-check support (CGI only)
│ │
- Pastikan file php.ini di /usr/local/etc/php.ini enable_dl=On
- Copi file phpshield.5.2.fre yang sudah didownload tadi ke direktori letak PHP5-EXTENSION berkumpul, Default berada di folder
blog# pwd
/usr/local/lib/php/20060613
blog# ll
total 2882
-r–r–r– 1 root wheel 24730 Mar 31 17:55 bz2.so
-r–r–r– 1 root wheel 29934 Mar 31 17:55 calendar.so
-r–r–r– 1 root wheel 14341 Mar 31 17:56 ctype.so
-r–r–r– 1 root wheel 64993 Mar 31 17:56 curl.so
-r–r–r– 1 root wheel 166332 Mar 31 17:58 dom.so
-r–r–r– 1 root wheel 47700 Mar 31 18:56 ffmpeg.so
-r–r–r– 1 root wheel 36686 Mar 31 17:58 filter.so
-r–r–r– 1 root wheel 46866 Mar 31 17:58 ftp.so
-r–r–r– 1 root wheel 375696 Mar 31 17:59 gd.so
-r–r–r– 1 root wheel 15488 Mar 31 17:59 gettext.so
-r–r–r– 1 root wheel 190237 Mar 31 18:00 hash.so
-r–r–r– 1 root wheel 38077 Mar 31 18:00 iconv.so
-r–r–r– 1 root wheel 27177 Mar 31 18:00 json.so
-r–r–r– 1 root wheel 54530 Mar 31 18:01 mysql.so
-r–r–r– 1 root wheel 167518 Mar 31 17:57 pcre.so
-r–r–r– 1 root wheel 98943 Mar 31 18:01 pdo.so
-r–r–r– 1 root wheel 443637 Mar 31 18:02 pdo_sqlite.so
-rw-r–r– 1 root wheel 57644 Mar 31 18:24 phpshield.5.2.fre
-r–r–r– 1 root wheel 25531 Mar 31 18:02 posix.so
-r–r–r– 1 root wheel 58435 Mar 31 18:02 session.so
-r–r–r– 1 root wheel 42942 Mar 31 17:57 simplexml.so
-r–r–r– 1 root wheel 28741 Mar 31 18:03 snmp.so
-r–r–r– 1 root wheel 178178 Mar 31 17:57 spl.so
-r–r–r– 1 root wheel 367653 Mar 31 18:03 sqlite.so
-r–r–r– 1 root wheel 19318 Mar 31 18:04 tokenizer.so
-r–r–r– 1 root wheel 45596 Mar 31 18:04 xml.so
-r–r–r– 1 root wheel 33696 Mar 31 18:04 xmlreader.so
-r–r–r– 1 root wheel 32389 Mar 31 18:05 xmlwriter.so
-r–r–r– 1 root wheel 80516 Mar 31 18:05 zip.so
-r–r–r– 1 root wheel 33805 Mar 31 18:05 zlib.so
blog#
- kemudian modif file /usr/local/etc/php/extensions.ini
Tambahkan modul untuk meload phpshield library
extension=phpshield.5.2.freextension=bz2.so
extension=calendar.so
extension=ctype.so
extension=curl.so
extension=pcre.so
extension=simplexml.so
extension=spl.so
extension=dom.so
extension=filter.so
extension=ftp.so
extension=gd.so
extension=gettext.so
- Pastikan ketika mengetikkan perintah php -v tidak ada warning Error
blog# php -v
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 31 2008 17:15:26)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
blog#
- Selanjutnya Reload apache anda dengan mengetikkan perintah /usr/local/etc/rc.d/apache22 reload
- Langkah selanjutnya adalah melengkapi Server kita dengan berbagai macam Tools Multimedia
Install FFMPEG
blog# cd /usr/ports/multimedia/ffmpeg
blog# make && make install clean
FFMPEG-PHP
blog# cd /usr/ports/graphics/php5-ffmpeg
blog# make && make install clean
FLVTOOL2
blog# cd /usr/ports/multimedia/ruby-flvtool2
blog# make && make install clean
MPLYER
blog# cd /usr/ports/multimedia/mplayer
blog# make && make install clean
MENCODER
blog# cd /usr/ports/multimedia/mencoder
blog# make && make install
ALL PHP requirements setout on our website
blog# cd /usr/ports/lang/php5-extensions/
blog# make && make install
- Proses instalasi mencoder dan mplayer akan memakan waktu cukup lama, bergantung dengan speed koneksi internet anda, Siapkan Kopi dan Cemilan secukupnya sembari proses instalasi berjalan sukses
- Setelah semua program sukses terinstall, buka lagi Web PHPMOTION http://IP-SERVER-ANDA/PHPMOTION/siteadmin/tester.php
- Pastikan semua tulisan berada pada posisi OK dan berwarna Hijau.
- Selanjutnya anda perlu membuat database mysql untuk si PHPMOTION ini, misal saya mau kasih contoh nama databasenya phpmotion maka yang saya lakukan adalah sbb
blog# mysql -u gigih -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 16608
Server version: 5.0.45 FreeBSD port: mysql-server-5.0.45_1Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
mysql> create database phpmotion;
Query OK, 1 row affected (0.00 sec)mysql>quit
- Masuk ke direktori class PHPMOTION
blog# pwd
/usr/hosting/PHPMOTION/classes
blog# ll
total 292
1317 Mar 31 19:24 ads.inc.php
3663 Apr 1 09:45 config.inc.php
251494 Mar 31 19:24 config.php
1565 Mar 31 19:24 login_check.php
1320 Mar 31 19:24 menu.php
1433 Mar 31 19:24 menu_groups.php
156 Mar 31 19:24 sessions.php
5839 Apr 1 13:03 settings.php
blog#
Edit file config.inc.php
//Your database settings
$config[“hostname”] = ‘localhost‘; // example ‘localhost’;
$config[“dbusername”] = ‘root‘; // example ‘myusername’;
$config[“dbpassword”] = ‘Passwordmysqlanda‘; // example ‘mypassword’;
$config[“dbname”] = ‘phpmotion‘; // example ‘mydatabase’;//To debug ffmpeg set $debugmode to 1; (default is 0)
$debugmode = 1 ;
//You can also create a log file to help with debug
$log_encoder = “yes”; //change to “yes” to create a log file in /logs)
//path to php
/////////////
$path_to_php = “/usr/local/bin/php”;
Pastikan $ debugmode=1 dan $log_encoder = “YES” untuk memudahkan penelusuran terhadap kesalahan dan kejadian selama system berjalan, namun jika dirasakan sistem sudah jalan dengan normal sebaiknya kedua statement ini dihilangkan saja
Contoh file log yang dibuat oleh sistem
blog# ll
total 3368
-rw-r–r– 1 www www 1074900 Apr 1 09:43 logfile.rtf
blog#
Contoh Log yg muncul karena program mencoder belum terinstall
PHPmotion Convertor.php debug
CLI for convertor OK
31-03-08
=====================================================================
PHPmotion debug
/usr/bin/mencoder /usr/hosting/PHPMOTION/uploads/avi/TGhilFdPrfVE0AmZrjRo.avi -o /usr/hosting/PHPMOTION/uploads/TGhilFdPrfVE0AmZrjRo.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=450:400 -srate 22050
Command was executed.See rest of log for output details
====================================================================
PHPmotion debug
/usr/local/bin/flvtool2 -U /usr/hosting/PHPMOTION/uploads/TGhilFdPrfVE0AmZrjRo.flv
Command was executed.See rest of log for output detailsDate: 31-03-08
STEP 1 – OUTPUT
/usr/bin/mencoder /usr/hosting/PHPMOTION/uploads/avi/TGhilFdPrfVE0AmZrjRo.avi -o /usr/hosting/PHPMOTION/uploads/TGhilFdPrfVE0AmZrjRo.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=450:400 -srate 22050
/usr/bin/mencoder: not found
Log yang normal contohnya adalah sebagai berikut
PHPmotion Convertor.php debug
CLI for convertor OK
01-04-08
===================================================================
CLI for convertor OK
01-04-08
===================================================================
/usr/local/bin/mencoder /usr/hosting/PHPMOTION/uploads/avi/pFHQjZGhjCJITcaZzi3V.avi -o
/usr/hosting/PHPMOTION/uploads/pFHQjZGhjCJITcaZzi3V.flv -of lavf -oac mp3lame -lameopts abr:br=56
-ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050
Command was executed.See rest of log for output details
===================================================================
/usr/local/bin/flvtool2 -U /usr/hosting/PHPMOTION/uploads/pFHQjZGhjCJITcaZzi3V.flv
Command was executed.See rest of log for output details
=================================================================
FFMPEG-PHP – check – Video Duration = 00:02:44
=================================================================
PHPmotion debug
/usr/local/bin/ffmpeg -i /usr/hosting/PHPMOTION/uploads/pFHQjZGhjCJITcaZzi3V.flv -ss 00:01:22 -t 00:00:01
-s 120×90 -r 1 -f mjpeg /usr/hosting/PHPMOTION/uploads/thumbs/pFHQjZGhjCJITcaZzi3V.jpg
Command was executed.See rest of log for output details
================================================================Date: 01-04-08
STEP 1 – OUTPUT
/usr/local/bin/mencoder /usr/hosting/PHPMOTION/uploads/avi/pFHQjZGhjCJITcaZzi3V.avi -o
/usr/hosting/PHPMOTION/uploads/pFHQjZGhjCJITcaZzi3V.flv -of lavf -oac mp3lame
-lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050
MEncoder 1.0rc1-4.2.1 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Xeon(TM) CPU 3.00GHz (Family: 15, Model: 4, Stepping: 10)
MMX supported but disabled
MMX2 supported but disabled
SSE supported but disabled
SSE2 supported but disabled
CPUflags: Type: 15 MMX: 0 MMX2: 0 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions:
CHMOD SETTINGS
Directories
1. uploads 777
2. uploads/thumbs 777
3. uploads/avi 777
4. pictures 777
5. cgi-bin 755
6. temp 777
7. classes 777
8. SQL 755
9.logs 777Files
1. all the files in cgi-bin 755
2. convertor.php 777
- Contoh VHOST APACHE SAYA, jangan lupa folder cgi-bin di PHPMOTION diaktifkan
## VHOST utube
<VirtualHost *:80>
<Directory “/usr/hosting/PHPMOTION”>
Options Indexes FollowSymLinks
AllowOverride FileInfo Options
Order allow,deny
Allow from all
</Directory>ServerAdmin // <![CDATA[
var prefix = 'ma' + 'il' + 'to';
var path = 'hr' + 'ef' + '=';
var addy13501 = 'admin' + '@';
addy13501 = addy13501 + 'unila' + '.' + 'ac' + '.' + 'id';
document.write( '‘ );
document.write( addy13501 );
document.write( ” );
// ]]>admin@unila.ac.id
This email address is being protected from spam bots, you need Javascript enabled to view itDocumentRoot /usr/hosting/PHPMOTION
ServerName utube.unila.ac.id
ErrorLog /usr/hosting/mediawiki/log/httpd-error.log
CustomLog /usr/hosting/mediawiki/log/httpd-access.log common<Directory /usr/hosting/PHPMOTION>
Options ExecCGI
</Directory>ScriptAlias /cgi-bin/ /usr/hosting/PHPMOTION/cgi-bin/
</VirtualHost>
- Buka lagi browser anda dengan mengetikkan
http://IP-SERVER-ANDA/PHPMOTION/siteadmin/setup.php
masukkan parameter database yang sudah dibuat tadi
- Yap udah beres sekarang anda sudah memiliki server YOUTUBE sendiri
login : admin
pass : admin
silahkan explore sendiri
oprekan saya ada di alamat http://utube.unila.ac.id