OpenView Mobile
protocol buffer on php

First, install protobuf from source
$ git clone
$ cd protobuf
$ ./
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig # refresh shared library cache.

Second, install php-protocolbuffers
$ git clone
$ cd php-protocolbuffers
$ phpize
$ ./configure
$ make
$ sudo make install

# please add following line to your php.ini
$ sudo vi /etc/php/fpm-php5.6/ext/protocolbuffers.ini
$ sudo vi /etc/php/cli-php5.6/ext/protocolbuffers.ini
$ sudo ln -s /etc/php/fpm-php5.6/ext/protocolbuffers.ini /etc/php/fpm-php5.6/ext-active/protocolbuffers.ini
$ sudo ln -s /etc/php/cli-php5.6/ext/protocolbuffers.ini /etc/php/cli-php5.6/ext-active/protocolbuffers.ini

Third, install composer.phar
$ curl -s | php
$ sudo mv composer.phar /usr/local/bin

Fourth, install protoc-gen-php
$ git clone
$ cd

# add protocolbuffers/protoc-gen-php entry to your global composer.json ($HOME/.composer/composer.json)
"require": {
"protocolbuffers/protoc-gen-php": "dev-master"

# install with composer
$ composer.phar global install
# set PATH (add this line to your .bashrc or .zshrc.)
$ export PATH=$HOME/.composer/vendor/bin/:$PATH

Fifth, just make a demo
demo .proto file definition
package openviewmobile;
message Person
required int32 user_id = 1;
optional string name = 2;

okay, let’s generate php classes with protoc

$ protoc --php_out . person.proto

when you want to use openviewmobile\Person class, you just do require person.proto.php.

$raw = $person->serializeToString();
echo $raw

Google Protocol Buffers Official Doc
php-protocolbuffers wiki
Protocol Buffers – Google’s data interchange format


protocol buffer on php

First, install protobuf from source $ git clone $ cd protobuf $ ./ $ ./configure $ make $ make check $ sudo make install $ sudo ldconfig # refresh shared library cache. Second, install php-protocolbuffers $ git clone $ cd php-protocolbuffers $ phpize $ ./configure $ make $…

multiple git sites using different ssh keys

First, you must use ssh-keygen to generate ssh key for your different accessing git sites. Like github, gitlab, or gitcafe etc. $ ssh-keygen -t rsa -b 4096 -C “” Finally, edit ~/.ssh/config to add configuration to specific git site $ vi ~/.ssh/config Host RSAAuthentication yes IdentityFile ~/my-ssh-key-directory/my-gitlab-private-key-filename User git…

How To Build openwrt for WR841N on linux from source codes

First, setup build environment, different linux distribution use different method. ignore… Next, fetch the openwrt surce code # git clone git:// Next, install extra packages # ./scripts/feeds update -a # ./scripts/feeds install -a Next, config the source codes # make menuconfig Target System—AR71xx/AR7240/AR913x/AR934x Target Profile—TP-LINK WR841N/ND LuCI—>Collections—– luci Next, build…

How To Install authpuppy on Nginx

As we know the authpuppy official wiki website only supply the installation guide on apache web server, but as a good result as I practiced, it can be successfully installed on the nginx web server. Go on details, my linux server using Gentoo Linux, but i think it works on any…

Build squashfs tools for Mac OS X

To squash/unsquash a Linux squashfs filesystem on a Mac, you can build the squashfs tools. A few modifications of the source are required for OS X: The FNM_EXTMATCH flag doesn’t exist in the fnmatch library on OS X. This just means that you can’t use glob patterns with mksquashfs. The constants to figure out…

18 commands to monitor network bandwidth on Linux server

Network monitoring on Linux This post mentions some linux command line tools that can be used to monitor the network usage. These tools monitor the traffic flowing through network interfaces and measure the speed at which data is currently being transferred. Incoming and outgoing traffic is shown separately. Some of…

How to install latest PHP 5.4.x on Ubuntu 12.04 LTS

1. Add this package-repository to your system. If Ubuntu says that you need to download a key first, then follow the instructions given in the notice. sudo add-apt-repository ppa:ondrej/php5-oldstable If you get an error message now, then please do an update first and install the python-software-properties, that need to be…

How To Install and Use Memcache on Ubuntu 12.04

About Memcache Memcache is a system that works to speed up virtual private servers by caching server information. The program allows you to allocate a specific amount of the server ram toward caching recently queried data for a certain amount of time. Once the data is requested again, memcache speeds…


在某些环境中,系统管理员想要允许极少数用户在可以传输文件到Linux机器中,但是不允许使用 SSH。要实现这一目的,我们可以使用SFTP,并为其构建chroot环境。 SFTP & chroot背景: SFTP是指SSH文件传输协议(SSH File Transfer protocol)或安全文件传输协议(Secure File Transfer Protocol),它提供了可信数据流下的文件访问、文件传输以及文件管理功能。当我们为SFTP配置chroot环境后,只有被许可的用户可以访问,并被限制到他们的主目录中,换言之:被许可的用户将处于牢笼环境中,在此环境中它们甚至不能切换它们的目录。 在本文中,我们将配置Ubuntu 12.04.5 LTS中的SFTP Chroot环境。我们开启一个用户帐号‘Guest’,该用户将被允许在Linux机器上传输文件,但没有ssh访问权限。 步骤:1 创建组 $ sudo groupadd  sftp_users 步骤:2 分配附属组(sftp_users)给用户 如果用户在系统上不存在,使用以下命令创建( 这里给用户指定了一个不能登录的 shell,以防止通过 ssh 登录): $ sudo useradd  -G sftp_users  -s /bin/false  guest $ sudo passwd guest 对于已经存在的用户,使用以下usermod命令进行修改: $ sudo usermod –G sftp_users  -s /bin/false  guest 注意:如果你想要修改用户的默认主目录,那么可以在useradd和usermod命令中使用‘-d’选项,并设置合适的权限。 步骤:3 现在编辑配置文件 “/etc/ssh/sshd_config” $ sudo vi /etc/ssh/sshd_config  #comment out the below line and add a line like below #Subsystem sftp /usr/libexec/openssh/sftp-server   Subsystem sftp internal-sftp # add Below lines  at the end of file Match Group sftp_users…


面板类: 国外: VestaCP: (目前最为推荐的面板,自带中文) Kloxo-MR: (7.0真的很强大,很好看,很实用,有中文包) Webmin/Virtualmin: (很稳定,很安全,自带中文) Ispconfig: (官网安装我都没看懂,这个网址是一键安装的) Webuzo: (个人用还是不错的) centos webpanel: (据说比较有发展前途) Froxlor: (很轻量的,适应各种环境) Ajenti: (自带中文) i-MSCP:  (简单易用) zPanel(sentora):  (支持win) AlternC: (简单) 国内: (4.2版免费) (简单易用,近来爆出不少严重安全漏洞) (全能空间) (支持freeBSD) 一键包: 国外: (据说很适合wordpress)  (lowendscript演变来的) 国内: (用的人很多,适应性很强) (很好用的LAMP一键包) (适合小内存≥64M的LAMP) (阿里云论坛看到的)…