Install MongoDB on MAMP

1. Add MAMP’s bin to the $PATH, make suit with your PHP version:
export PATH="/Applications/MAMP/bin/php/php5.x.x/bin:$PATH"
2. Download PHP source same with your PHP version and put into /Applications/MAMP/bin/php/php5.x.x/include
3. Configure PHP:
cd /Applications/MAMP/bin/php/php5.x.x/include/php

4. When finish, install mongodb:
sudo pecl install mongo
5. Go to MAMP and edit template PHP.ini and add mongodb extension:
6. Restart your MAMP and you check phpinfo() to make sure mongodb extension installed perfectly.

Posted in Uncategorized

How To Store PHP Sessions in Memcached on a CentOS

Store PHP Sessions in memcached will improved the performance for busy server. Why? Because memcached will store session in memory instead of files. The following how to install Memcached and buold PHP memcached extension:
1. Install Memcached:
# yum install memcached
2. Since memchached isn’t protected with a username and password, so anyone can access it via port 11211. The solution is only listening localhost.
Let’s edit /etc/sysconfig/memcached and change:

3. Start memcached:
# /etc/init.d/memcached start
4. To start automatically on boot, run this command:
# chkconfig --levels 235 memcached on
5. The next step is build the memcached extension:
# yum install zlib-devel libmemcached-devel
# pecl install memcached

6. Edit php.ini and change the configuration to:
session.save_handler = memcached
session.save_path = ""

7. Restart apache
# /etc/init.d/httpd restart

And check using phpinfo. You should get the configuration changes like the following screenshot:

Posted in CentOS, Linux

Install H264 Streaming Module for Apache on CentOS

If you have site has mp4 video, the visitor will need to get all mp4 video downloaded. It’s bad for video longer and has low bandwith. You need a plugin for pseudo-streaming.
The H264 Streaming Module is a plugin for your existing Apache/Lighttpd/Nginx webserver. Its features are as follows:
Timeshifting seek
Enable your viewers to immediately jump to any part of the video regardless of the length of the video or whether it has all been downloaded yet.

Virtual video clips
You have really long video clips and you don’t want to re-encode them into smaller parts? We also support ‘virtual video clips’, so you can specify to only playback a part of the video or create download links to specific parts of the video.

Virtual video clips also enables possibilities for ​Adaptive Streaming.
An easy way for making previews available, say for example when you want to differentiate between registered and unregistered users. Here’s a little tutorial for the different web servers on url rewriting and virtual video clips.

Network efficiency
The next version will feature ‘bandwidth shaping’ allowing you to stream videos and only use the bandwidth required to view the video over the network.

If you are already using the widely adopted MPEG4/H264 industry standard, there is no need to re-encode your MP4 videos, you can use your existing video files.

The following step by step to install H264 Streaming module for Apache on CentOS

Download the source of the H264 Streaming Module for Apache and extract it

$ wget
$ tar -zxvf apache_mod_h264_streaming-2.2.7.tar.gz
$ cd mod_h264_streaming-2.2.7
$ ./configure
$ make
# make install

The location for installed modules is: /usr/local/apache/modules

Edit /usr/local/apache/conf/httpd.conf
Add the following lines:

LoadModule h264_streaming_module /usr/local/apache/modules/
AddHandler h264-streaming.extensions .mp4

Then restart your apache:

# /etc/init.d/httpd start

Make sure the module is loaded, you can check using command:

# /usr/local/apache/bin/apachectl -t -D DUMP_MODULES | grep h264_streaming_module

Now you can enjoy faster loading video on your site!

Posted in CentOS, Linux

Install PHP Mongodb driver on MAMP OSX

If you use MAMP and want to use mongodb database, here’s the following step to install PHP Mongo driver.
Requirements: Xcode installed.
1. Grab the latest PHP mongodb driver
$ git clone
$ cd mongo-php-driver
$ /Applications/MAMP/bin/php/php5.4.4/bin/phpize
suit the phpize location with your PHP version. In this case i am using PHP 5.4.4.
$ ./configure
$ make
if you got error like this:
mongo-php-driver/php_mongo.c:16:10: fatal error: ‘php.h’ file not found
#include then you should copy php headers into your MAMP folder
$ cp -r /Applications/ /Applications/MAMP/bin/php/php5.4.4/include
$ sudo cp modules/ /Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/
again suit the extension location
2. Open your MAMP GUI and go to File – Edit Template – PHP 5.4.4 ini
3. Add the following line:
4. Restart your MAMP web server and check with phpinfo() and you should get the mongodb installed

Posted in OSX

Reset factory openwrt using arduino

If you have an openwrt router and need to reset to factory setting, but you can’t enter the console such as lost IP for your router or wrong configuration so the router can’t accessible, you’re not alone. You need USB to TTL adapter, but you can use Arduino as a serial adapter. The following using Arduino:
1. Connect RX pin of the arduino (pin 0) to the TX pin of your router.
2. Connect TX pin of the arduino (pin 1) to the RX pin of your router.
3. In this case i am using router TP-LINK TL WR841ND v8.1, so i don’t need to connect VCC router to arduino.
3. Connect RESET pin of the arduino to the GND pin of the arduino.
4. Connect arduino to the PC via usb and open minicom console. I am using 115200 8N1 XON/XOFF.
5. Bring up router. You’ll see messages on your minicom console. After show # prompt, type: firstboot to reset openwrt to factory setting. Then reboot your router. Just that is and good luck!



Posted in Arduino Tagged with: ,

Mounting HFS+ Volume on CentOS

The easy way to mountint HFS+ Volume on CentOS is using elrepo. But right now it’s only read only mount.

First you need to import elrepo GPG Key:

# rpm --import

Open this page to get the latest version of elrepo for your CentOS version. On this texts written, the latest version for CentOS 6 is 6.6

# rpm -Uvh

The last step is to install kmod hfsplus

# yum install kmod-hfsplus

Now you can mount the hfs volume as others filesystem type!

Posted in CentOS, Linux

Downgrade BBM for BlackBerry

BlackBerry versi 8 baru saja dirilis. Mengusung fitur terbarunya: BBM Channels. BBM Channels ini mirip dengan Facebook fanpage. Pengguna bisa bergabung dengan channel atau bahkan bisa membuat channel sendiri. Namun demikian, bagi pengguna BlackBerry yang masih menggunakan OS7 dan dibawahnya, BBM versi terbaru ini sangat lambat. Maklum saja karena masi menggunakan processor yang berkecepatan lambat dan RAM yang cukup kecil. Tidak demikian dengan OS10. Dengan OS yang benar-benar baru dan didukung hardware yang cukup kencang, BBM versi terbaru ini cukup cepat, hampir tidak berbeda dengan versi sebelumnya. Nah, bagi pengguna BlackBerry versi 7 dan dibawahnya yang sudah terlanjur diupgrade ke versi 8 dan ingin mengembalikan ke versi 7 yang belum ada fitur BBM Channelnya, silahkan pilih link berikut. Pilihlah yang sesuai dengan OS yang digunakan pada smartphone anda.

BBM Versi (OS 5)
BBM Versi (OS 6)
BBM Versi (OS 7)
BBM Versi (OS 7.1)

Posted in BlackBerry Tagged with:

Install php-ffmpeg on CentOS

The easy way to install php-ffmpeg. The following works for CentOS 5 and CentOS 6.

Install ffmpeg and ffmpeg-devel
# yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg
# rpm --import
# vim /etc/yum.repos.d/atrpms.repo

name=Fedora Core $releasever - $basearch - ATrpms

name=Fedora Core $releasever - $basearch - ATrpms

# yum --enablerepo=atrpms* install ffmpeg ffmpeg-devel

Install php-ffmpeg
Download php-ffmpeg from then extract it on a folder. Or the easy way is using git if you have git installed:
$ git clone
$ cd ffmpeg-php
Then install it:
# phpize
# ./configure
# make
# make install

Edit php.ini:

Posted in CentOS, Linux

Install SSL Certificate on zPanel

The following is an simplified how to install SSL Certificate on zPanel. You can use a self-signed SSL Certificate or buy.

First create ssl directory to easy maintain:
$ mkdir /var/zpanel/hostdata/zadmin/ssl

Then go to ssl directory:
$ cd /var/zpanel/hostdata/zadmin/ssl

Generate private key. If you use a self signed SSL Certificate, you can use 1024 RSA key, but if you buy a certificate like InstantSSL, most of them need at least 2048 bit RSA key.
$ openssl genrsa -des3 -out server.key 2048

Generate CSR (Certificate Signing Request):
$ openssl req -new -key server.key -out server.csr

Remove Passphrase from Key
$ cp server.key
$ openssl rsa -in -out server.key

If you want to use a self signed, generate a self signed certificate:
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Or if you want to buy a certificate, please submit server.key to a SSL Provider, then you’ll get .crt and .ca-bundle files.

Install the Private Key and Certificate.
Please make sure mod_ssl was installed on your server. If didn’t installed yet, you can install it.
For CentOS:
# yum install mod_ssl
For Ubuntu:
# apt-get install mod_ssl

Go Server Admin – Module Admin – Override a Virtual Host Setting – Select a domain and click Select Vhost:
On port override field, fill: 443
Check ‘Forward Port 80 to Overriden Port’ if you want to always use HTTPS
Fill IP Override with your Server IP Address.
If you use a self-signed certificate, fill custom entry with:
SSLEngine On
SSLCertificateFile /var/zpanel/hostdata/zadmin/ssl/server.crt
SSLCertificateKeyFile /var/zpanel/hostdata/zadmin/ssl/server.key
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/yourdirectory"

If you use trusted SSL Certificate, fill custom entry with:
SSLEngine On
SSLCertificateFile /var/zpanel/hostdata/zadmin/ssl/server.crt
SSLCertificateKeyFile /var/zpanel/hostdata/zadmin/ssl/server.key
SSLCertificateChainFile /var/zpanel/hostdata/zadmin/ssl/
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/yourdirectory"

Click Save VHost

Then final step restart apache:
#/etc/init.d/httpd stop
#/etc/init.d/httpd start

Posted in CentOS, Linux, Ubuntu, zPanel

Selamat Idul Fitri 1434H

Idul Fitri 1434H

Posted in Uncategorized