centOSにmecabをインストール

cd /usr/local/src
wget “https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE” -O mecab-0.996.tar.gz
sudo tar -zxvf mecab-0.996.tar.gz

[vagrant@localhost src]$ ls
mecab-0.996 mecab-0.996.tar.gz

sudo ./configure –with-charset=utf8

sudo wget “https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM” -O mecab-ipadic-2.7.0-20070801.tar.gz

$ tar zxfv mecab-ipadic-2.7.0-20070801.tar.gz
$ cd mecab-ipadic-2.7.0-20070801
$ ./configure –with-charset=utf8
$ make
$ make install

[vagrant@localhost mecab-ipadic-2.7.0-20070801]$ echo すもももももももものうち | mecab
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS

ぎゃああああああああああああああああああああ

$ git clone https://github.com/rsky/php-mecab.git
$ cd php-mecab/mecab/
$ phpize
$ ./configure –with-mecab=/usr/local/src/mecab-0.996/mecab-config
$ make
$ make test
$ make install
[vagrant@localhost mecab]$ ls /usr/lib64/php/modules/ | grep mecab
mecab.so
[vagrant@localhost mecab]$ vim /etc/php.d/mecab.ini
-bash: vim: コマンドが見つかりません
[vagrant@localhost mecab]$ vi /etc/php.d/mecab.ini
[vagrant@localhost mecab]$ sudo vi /etc/php.d/mecab.ini
[vagrant@localhost mecab]$ sudo service httpd restart
httpd を停止中: [ OK ]
httpd を起動中: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain for ServerName
[ OK ]
[vagrant@localhost mecab]$ php -m | grep mecab
mecab

ぎょえええええええええええええええええええ

$str = 'すもももももももものうち';

$mecab = new Mecab_Tagger();
$nodes = $mecab->parseToNode($str);
foreach ($nodes as $n) {
    $items = $n->getFeature();
    echo $items . "<br>";
}

BOS/EOS,*,*,*,*,*,*,*,*
名詞,一般,*,*,*,*,すもも,スモモ,スモモ
助詞,係助詞,*,*,*,*,も,モ,モ
名詞,一般,*,*,*,*,もも,モモ,モモ
助詞,係助詞,*,*,*,*,も,モ,モ
名詞,一般,*,*,*,*,もも,モモ,モモ
助詞,連体化,*,*,*,*,の,ノ,ノ
名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
BOS/EOS,*,*,*,*,*,*,*,*

oh my god.