Install Red5 Media Server on Ubuntu / Debian


Hits: 5006  

Red5 is free media server based on Java and other open source frameworks. It support FLV, F4V, MP4, 3GP, MP3, F4A, M4A, AAC and protocols like RTMP, RTMPT, RTMPS, RTMPE.

Install Red5 Media server
# apt-get install red5-server

Red5 Need below ports open in firewall / iptable
RTMP: 1935
Debug proxy: 1936
HTTP servlet: 5080
RTMPT: 8088

Red5 Installed location
/usr/share/red5/

Red5 application in the location
/usr/share/red5/webapps

Install demo Red5 Applications
# wget http://www.red5.org/downloads/red5/1_0_1/red5-1.0.1.zip
# mkdir red5/
# cd red5
# unzip ../red5-1.0.1.zip
# cd red5-server-1.0/
# cp -R webapps/root/demos /var/lib/red5/webapps/root/demos
# cp -R webapps/installer /var/lib/red5/webapps/installer
# find /var/lib/red5/webapps/ -type d -exec chown _red5 {} \;
# /etc/init.d/red5-server restart

Red5 Installer
http://server-ip-address:5080/installer/

Red5 Demo
http://server-ip-address:5080/demos/

PHP Run Background Process using Exec


Hits: 8678  

If you need to start process in background and get its PID to manage it later using PHP.

<?php

function runInBackground($command,$log,$priority=0)
{
if($priority)
   $PID=shell_exec("nohup nice -n $priority $command > $log 2>&1 & echo $!");
else
   $PID=shell_exec("nohup $command > $log 2>&1 & echo $!");
return($PID);
}

?>
PHP Process
PHP Process

echo $! will return process ID
# Command & echo $!

 

Check if process is running

<?php

function isProcessRunning($PID)
{

if($PID==0)return false;
if($PID=="")return false;

exec("ps -p $PID 2>&1",$state);
return(count($state)>=2);

}

?>

 

Display Process Logs

<?php

function displayProcessLog($logfile)
{

exec('cat $logfile 2>&1',$log);
return implode("\r\n",$log);

}

?>

 

Kill Process

<?php

function killProcess($PID)
{
 exec('kill '.$PID.' 2>&1',$status);
 return implode("\r\n",$status);
}

?>

 

Save Process ID to file

#!/bin/bash
Command &
echo $! >/path/to/pid.file

Install Apache, PHP, MySQL on HP Cloud


Hits: 5512  

I am playing with all cloud services these days, so today we will try to setup Apache, PHP, MySQL on HP Cloud. HP Cloud is based on OpenStack Compute

Hope you already read our old article “Installing Apache, MySQL, PHP in CentOS 5.5 on Rackspace Cloud”?

In the HP Cloud Console Area you can manage

– Servers / Storage
– Floating IPs
– Images
– Key Pairs
– Security Groups
– Volumes

First you need to create Key Pairs and some rule in security default group…

Security Group Rules
Security Group Rules

HP Cloud Compute Overview

HP Cloud Object Storage Overview

You can start any type of server CentOS, Ubuntu using HP Cloud GUI …

Server on HP Cloud
Server on HP Cloud

Also you can manage running instances easily…

Manager Server on HP Cloud
Manager Server on HP Cloud

You can connect to server using SSH on port 22

# ssh -i KEYPair.pem root@IP-Address

In windows.. create PPK file from PEM Keypair using PuTTYgen

Install Apache

# sudo yum install httpd mod_ssl

Install MySQL

# yum install mysql mysql-server
# /etc/init.d/mysqld start

Install PHP

# yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml php-mbstring

# /etc/init.d/httpd start

You can access HP Cloud using HP Cloud Services APIs and HP Cloud Services CLI