MessagePack + PHP

今回使いたい基本的なツールを一通り確認しておく。

http://msgpack.org/

$ mkdir msgpack && cd msgpack
$ git clone https://github.com/msgpack/msgpack-php.git .
Initialized empty Git repository in /opt/installer/php/msgpack/.git/
remote: Counting objects: 514, done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 514 (delta 404), reused 484 (delta 374)
Receiving objects: 100% (514/514), 158.56 KiB | 133 KiB/s, done.
Resolving deltas: 100% (404/404), done.
$ ls
CREDITS        config.m4        msgpack_convert.c  package.xml
ChangeLog      config.w32       msgpack_convert.h  php-msgpack.spec
EXPERIMENTAL   msgpack          msgpack_errors.h   php_msgpack.h
LICENSE        msgpack.c        msgpack_pack.c     test_normal.php
README.md      msgpack.php      msgpack_pack.h     test_streaming.php
bench          msgpack_class.c  msgpack_unpack.c   tests
benchmark.php  msgpack_class.h  msgpack_unpack.h

# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

# ./configure && make && make install

Installing shared extensions:     /usr/lib64/php/modules/
Installing header files:          /usr/include/php/

# echo “extension=msgpack.so” > /etc/php.d/msgpack.ini

# php test_normal.php
array(3) {
 [0]=>
 int(1)
 [1]=>
 int(2)
 [2]=>
 int(3)
}
string(10) “0x93010203″
array(3) {
 [0]=>
 int(1)
 [1]=>
 int(2)
 [2]=>
 int(3)
}

msgpack.iniだけ自分で書いた以外は何もしていません。
問題なくインストール出来たようです。

サーバーのバージョンとか

# php -v
PHP 5.3.3 (cli) (built: Jul  3 2012 16:53:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

# cat /etc/redhat-release
CentOS release 6.2 (Final)

# arch
x86_64

msgpack.jsもあるので
そのまま使う場合はjson使うのやめてクライアント側もmessagepackで良いのかなと

This entry was posted on 水曜日, 11月 7th, 2012 at 1:07 PM and is filed under Javascript, php, server. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。