4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HHVMをCentOS6.5 - lamp - Wordpress環境で動作させた時のメモ

Last updated at Posted at 2015-05-27

facebookが開発したというPHPのJITコンパイラー環境「HipHop Virtual Machine」をさくらVPS上で動かした時のメモ。

以前のコンパイラーであるHipHopforPHPは実行させるまでかなり面倒が重なったり、ワードプレスがなかなか動かなかったので諦めていましたが、今回は期待大でした。

サーバ上で複数ドメインを名前ベースで運用しており、全て動かすことを念頭に、、

まずはyumでhhvmをインストール。

# cd /etc/yum.repos.d
# wget http://www.hop5.in/yum/el6/hop5.repo
# sudo yum install hhvm
# sudo yum update hiphop-php

Apacheのバージョンが2.2系のためfastcgiを入れる。

# yum install mod_fastcgi --enablerepo=rpmforge

/etc/httpd/conf.d/fastcgi.confを編集

User apache
Group apache
LoadModule fastcgi_module modules/mod_fastcgi.so
DirectoryIndex index.php
<IfModule mod_fastcgi.c>
<FilesMatch .php$>
SetHandler hhvm-php-extension
</FilesMatch>
Alias /hhvm /hhvm
Action hhvm-php-extension /hhvm virtual
FastCgiExternalServer /hhvm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
</IfModule>

/etc/hhvm/php.iniに追加 ↓

date.timezone = "Asia/Tokyo"

コマンドを打ってhhvmを常駐させる

# hhvm --mode daemon -vServer.Port=9000 -vServer.Type=fastcgi -vServer.FixPathInfo=true -config /etc/hhvm/config.hdf

このままだと既存のApacheのモジュールPHPが動いたままなので、/etc/httpd/conf.d/php.confをそのまま削除して無効にする。

デーモンを再起動してもいいが、OSを再起動することに。

# reboot

phpinfo.phpにアクセスすると、見事「hiphop」とだけ表示される。(セコい)

名前ベースで複数ドメインをWPで立ち上げていましたが、全て問題無く動作しました!

その他、/etc/init.dにhhvmスクリプトがあるので、自動スタート設定を作る。


ab等のツールで測っていませんが、表示・レンダリングの感じがとても速くなり、楽にブラウズできると実感しました。

4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?