我在IBM Bluemix上有一个Web应用程序。我想通过使用Facebook的HHVM预编译PHP来加速应用程序。如何才能做到这一点?这是否可以在Bluemix上使用?
谢谢,
-
答案 0 :(得分:3)
是的,这实际上是。这样做有点工作但是使用构建包你基本上可以运行任何可执行文件。您只需要绑定到由环境变量$PORT
分配的端口。查看实施的the Cloud Foundry Docs。我也会在C buildpack中占据一席之地。
binary buildpack可能是您最好的起点。
您可以使用HHVM编译代码,我从下面的here中提取了相关内容。这需要在 Ubuntu 14.04 上完成,因为这是Bluemix运行的。
安装deps:
sudo apt-get install autoconf automake binutils-dev build-essential cmake g++ gawk git \
libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev \
libboost-system-dev libboost-thread-dev libboost-context-dev libbz2-dev libc-client-dev libldap2-dev \
libc-client2007e-dev libcap-dev libcurl4-openssl-dev libdwarf-dev libelf-dev \
libexpat-dev libgd2-xpm-dev libgoogle-glog-dev libgoogle-perftools-dev libicu-dev \
libjemalloc-dev libmcrypt-dev libmemcached-dev libmysqlclient-dev libncurses-dev \
libonig-dev libpcre3-dev libreadline-dev libtbb-dev libtool libxml2-dev zlib1g-dev \
libevent-dev libmagickwand-dev libinotifytools0-dev libiconv-hook-dev libedit-dev \
libiberty-dev libxslt1-dev ocaml-native-compilers libsqlite3-dev libyaml-dev libgmp3-dev \
gperf libkrb5-dev libnotify-dev
下载HHVM源代码:
git clone git://github.com/facebook/hhvm.git --depth=1
cd hhvm
git submodule update --init --recursive
构建HHVM:
cmake -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock .
make -j [number_of_processor_cores] # eg. make -j 4
sudo make install
可以在/usr/local/bin
答案 1 :(得分:0)
使用内置的PHP buildpack很容易。只需在composer.json文件中指定对HHVM的依赖,如下所示:
{
"require": {
"hhvm": ">=3.5"
}
}