Creating Zip Without Recording ROOT Paths

Hits: 3906  

Simply use chdir() to change the working directory before you exec()

Or you can use ….

exec(“cd /var/www/html/media; zip -r -9 . 2>&1”, $log);

exec(“mv /var/www/html/media/ /var/www/html/”);

Get zip file size

exec(“ls -ls /var/www/html/ | awk ‘{print $6}’ 2>&1”, $size);

$zipsize = implode(” “, $size);

Without this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 15:10 /var/www/html/media/dialogs/
125305 08-07-12 16:31 /var/www/html/media/dialogs/1.3.mp3
125305 08-07-12 16:33 /var/www/html/media/dialogs/1.5.mp3
184864 08-07-12 16:32 /var/www/html/media/dialogs/1.4.mp3
125305 08-07-12 16:30 /var/www/html/media/dialogs/1.1.mp3
125305 02-24-13 16:48 /var/www/html/media/dialogs/1.2.mp3
125305 08-07-12 16:34 /var/www/html/media/dialogs/1.6.mp3

With this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 16:40 dialogs/
125305 08-07-12 16:51 dialogs/1.3.mp3
125305 08-07-12 16:53 dialogs/1.5.mp3
184864 08-07-12 16:52 dialogs/1.4.mp3
125305 08-07-12 16:50 dialogs/1.1.mp3
125305 02-24-13 16:58 dialogs/1.2.mp3
125305 08-07-12 17:04 dialogs/1.6.mp3

PHP Run Background Process using Exec

Hits: 8663  

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


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

PHP Process
PHP Process

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


Check if process is running


function isProcessRunning($PID)

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

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




Display Process Logs


function displayProcessLog($logfile)

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




Kill Process


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



Save Process ID to file

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

Install Apache, PHP, MySQL on HP Cloud

Hits: 5504  

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

FFmpeg – ERROR: librtmp not found

Hits: 8257  

I was installing FFmpeg for segmenting Red5 Streams to stream live video from Red5 Server to iOS or Android devices.

RTMP (Red5) -> FFMpeg -> Segementer -> .ts files -> iOS (m3u8)

I really needed mp4 (AAC/H.264) and ogg (Vorbis/Theora) format for best HTML5 output.

I checkout FFmpeg source and tryed below command to install / configure it

# ./configure –enable-gpl –enable-nonfree –enable-libmp3lame –enable-libfaac –enable-librtmp –enable-libtheora –enable-libvorbis –enable-libx264 –enable-shared –enable-postproc

error while loading shared libraries:

I have already installed all dependencies, but links to shared libraries was not found … so …

# echo “/usr/local/lib” >> /etc/
# echo “/usr/lib” >> /etc/
# ldconfig

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.

Another error ERROR: librtmp not found

# ls /usr/local/lib/librtmp*

/usr/local/lib/librtmp.a /usr/local/lib/

On CenOS before compiling ffmpeg, make sure you have valid path of packages in PKG_CONFIG_PATH

# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

We worked on RTMP (Live Red5 CAM) to iOS (iPhone or iPad). Get more help for HTTP Live Video Stream Segmenter and Distributor Contact Us

Read more…. VOD to iOS | Red5 Media Server iOS Android Setup

Recover MySQL root Password

Hits: 3007  

1. Stop the MySQL server.

# /etc/init.d/mysql stop

2. Start the MySQL server process with the –skip-grant-tables option so that it will not prompt for password.

# mysqld_safe –skip-grant-tables &

3. Connect to mysql server as the root.

# mysql -u root

mysql password
mysql password

Welcome to the MySQL monitor….
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

4. Setup new mysql root account password i.e. reset mysql password.

mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit

5. Exit and restart the MySQL server.

# /etc/init.d/mysql stop

6. Start MySQL server.

# /etc/init.d/mysql start
# mysql -u root -p



Install ImageMagick

Hits: 3158  

ImageMagick can be installed on Windows, Unix and Unix-like operating systems including Linux, Solaris, FreeBSD, Mac OS X, and others.

How to Install Imagemagick?
How to Install Imagemagick?

Note: Make sure you have installed GhostScript and FreeType already 😉
More help

Download & Unpack

# wget
# tar xvfz ImageMagick.tar.gz


# cd ImageMagick-6.8.0-4 (or current version)
# ./configure


# make


# make install


[root@svnlabs ImageMagick-6.8.0-4]# which convert

[root@svnlabs ImageMagick-6.8.0-4]# which display

Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats. In addition, resize, rotate, shear, distort or transform images automatically.

Red5 Media Server iOS Android Setup

Hits: 11490  

Hope you already read our previous article “VOD to iOS” ?


How you can use Red5 Server for streaming to iPhone, iPads and Android?

S V N Labs Softwares implements an iOS/Android add-on setup for Red5 Server to stream both Flash, iOS and Android devices. This add-on also supports setup of JW Player, Flowplayer and HTML5 embed player using Red5 live and on-demand streams. We are expert in setting up Red5 applications and developing custom apps and plug-ins for Red5 and other media servers including Wowza, Flash Media Server, Union etc.

Red5 Recorder allows wordpress users to easily use Red5 Recorder Player on their website to record Video / Audio Streams.
Users can record their video response / review using embedable red5 recorder and after recording they can send video email to wordpress admin. Both user and admin will get email from Red5 Recorder system to get Red5 Recorded Video Streams.

Red5 includes support for the latest multi-user API’s including NetConnection, NetStream and SharedObject’s while providing a powerful RTMP / Servlet implementation. In addition to support for the RTMP protocol, the application server has an embedded Tomcat Servlet container for JEE Web Applications. Application development draws additional benefits from the Spring Framework and Scope based event driven services.

Open Source Red5 Media Server also help you for developing extensible platform that can be used in Video Conferences, Multi-User Gaming and Enterprise Application Software. S V N Labs Softwares are also expert in RED5 and most other media servers including Wowza, Flash Media Server, Union etc. and we can assist to set up transcoding, segmenting, and ipad/iphone/android server-side configuration.

Get more help for HTTP Live Video Stream Segmenter and Distributor Contact Us

Install rtmpdump in CentOS

Hits: 9443  

I was compiling FFmpeg with RTMP support, but it requires librtmp >= 2.2.f

[root@svnlabs ffmpeg]# ./configure –enable-gpl –enable-nonfree –enable-libmp3lame –enable-libfaac –enable-librtmp –enable-libtheora –enable-libvorbis –enable-libx264 –enable-shared –enable-postproc –disable-yasm
Package librtmp was not found in the pkg-config search path.
Perhaps you should add the directory containing `librtmp.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘librtmp’ found
ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f

If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the mailing list or IRC #ffmpeg on
Include the log file “config.log” produced by configure as this will help
solving the problem.
[root@svnlabs ffmpeg]# rtmpdump -v
RTMPDump v2.2e
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: You must specify a hostname (–host) or url (-r “rtmp://host[:port]/playpath”) containing a hostname

Compiling latest rtmpdump-2.3.tgz

[root@svnlabs rtmpdump-2.3]# yum install openssl-devel

[root@svnlabs rtmpdump-2.3]# wget

[root@svnlabs rtmpdump-2.3]# tar xvf rtmpdump-2.3.tgz

[root@svnlabs rtmpdump-2.3]# cd rtmpdump-2.3
[root@svnlabs rtmpdump-2.3]# make
[root@svnlabs rtmpdump-2.3]# make install

Latest rtmpdump successfully installed…

[root@svnlabs rtmpdump-2.3]# rtmpdump
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: You must specify a hostname (–host) or url (-r “rtmp://host[:port]/playpath”) containing a hostname
[root@svnlabs rtmpdump-2.3]# whereis librtmp
librtmp: /usr/local/lib/librtmp.a /usr/local/lib/

If You still have issue … you can try magic path command 😉

# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig


How to check RTMP source stream is live or not?


VOD to iOS

Hits: 6182  

FFMpeg to encode and segment input video stream in the correct format for HTTP streaming protocol.

Download & Install HTTP Live Video Stream Segmenter and Distributor

# /usr/local/bin/live_segmenter <segment length> <output location> <filename prefix> <encoding profile>


M3U8 File:





Segmenter error: Could not open input file, make sure it is an mpegts file:

ffmpeg: relocation error: /usr/local/lib/ symbol av_expr_free, version LIBAVUTIL_50 not defined in file with link time reference

Point FFMpeg to the proper files

# export LD_LIBRARY_PATH=/usr/local/lib


# sudo ldconfig -v

We worked on RTMP (Live Red5 CAM) to iOS (iPhone or iPad). Get more help for HTTP Live Video Stream Segmenter and Distributor Contact Us

RTMP (Red5) -> FFMpeg -> Segementer -> .ts files -> iOS (m3u8)

Helpful links:
C++ RTMP Server –
mpegts-segmenter –

Install ionCube Loader

Hits: 6291  

1. Download ionCube loaders

# wget

2. Extract

# tar zxvf ioncube_loaders_lin_x86.tar.gz

3. Move to /usr/local

# mv ioncube /usr/local/

4. Add reference to php.ini file

Depending on PHP version select and files

# ls /usr/local/ioncube/

# vi /etc/php.ini


5. Restart apache

# /etc/init.d/apache2 restart