LoginSignup
3
3

More than 5 years have passed since last update.

MessagePack PHP拡張モジュールのインストール(PECL)

Last updated at Posted at 2015-07-26

最新バージョンの確認

下記サイトで、最新のバージョンを確認する。
https://pecl.php.net/package/msgpack

拡張モジュールのインストール

ソースからコンパイルしてインストールしたPHP環境にインストールする。

$ sudo pear clear-cache
$ sudo pear update-channels
$ sudo pear upgrade
$ sudo pecl install channel://pecl.php.net/msgpack-0.5.6
$ echo 'extension=msgpack.so' | sudo tee -a /usr/local/php-5.5.27/lib/php.ini
$ sudo /etc/rc.d/init.d/php-fpm restart

動作確認

$ cat << EOF | sudo tee /usr/share/nginx/virtualhost/index.php
<?php
\$data = array(0=>1,1=>2,2=>3);
\$msg = msgpack_pack(\$data);
\$data = msgpack_unpack(\$msg);
var_dump(\$data);
EOF
$ curl http://virtualhost.tatsunet.net/
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3