CentOS 7 安裝 PHP HHVM

HHVM 是 Facebook 開發的高效能 PHP 虛擬機, 執行速度宣稱比 PHP 官方版本快上 9 倍, 以下是在 CentOS 7 安裝 HHVM 的方法:

首先安裝 HHVM 必須的套件:

# yum install epel-release
# yum install gcc gcc-c++ cpp cmake git psmisc ocaml
# yum install binutils-devel boost-devel libmcrypt-devel libmemcached-devel jemalloc-devel libevent-devel sqlite-devel libxslt-devel libicu-devel tbb-devel libzip-devel bzip2-devel openldap-devel readline-devel elfutils-libelf-devel libdwarf-devel libcap-devel libyaml-devel libedit-devel lz4-devel libvpx-devel unixODBC-devel libgmp-devel libpng-devel ImageMagick-devel curl-devel expat-devel openssl-devel glog-devel oniguruma-devel

然後就可以在 Github 下載 HHVM 的源碼安裝:


# cd /usr/local/src
# git clone https://github.com/facebook/hhvm -b master hhvm –recursive
# cd hhvm
# cmake \
-DLIBMAGICKWAND_INCLUDE_DIRS=”/usr/include/ImageMagick-6″ \
-DLIBMAGICKCORE_LIBRARIES=”/usr/lib64/libMagickCore-6.Q16.so” \
-DLIBMAGICKWAND_LIBRARIES=”/usr/lib64/libMagickWand-6.Q16.so” .
# make -j$(($(nproc)+1))
# make install

建立 HHVM 的設定檔及紀錄檔目錄:

# mkdir /etc/hhvm
# mkdir /var/log/hhvm

建立檔案 /usr/lib/systemd/system/hhvm.service, 並加入以下內容:

執行以下指令啟動 HHVM, 及設定開機自動執行:

# systemctl enable hhvm
# systemctl start hhvm


Leave a Reply