I have a web application on IBM Bluemix. I would like to speed up the app by precompiling the PHP by using Facebook's HHVM. How can this be done? Is this possible on Bluemix?
Thank you,
--
I have a web application on IBM Bluemix. I would like to speed up the app by precompiling the PHP by using Facebook's HHVM. How can this be done? Is this possible on Bluemix?
Thank you,
--
收起
Yeah this actually would be. It would be a little work to do this but with a build pack you can basically run any executable file. You would just need to bind to the port that is assigned by environment variable $PORT
. Check out the Cloud Foundry Docs on implementing one. I would take a peak at the C buildpack as well.
The binary buildpack will probably be your best starting place.
You can compile your code using HHVM, I pulled out the relevant pieces from here below. This needs to be done on Ubuntu 14.04 as that is what Bluemix runs on.
Install 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
Downloading the HHVM source-code:
git clone git://github.com/facebook/hhvm.git --depth=1
cd hhvm
git submodule update --init --recursive
Build HHVM:
cmake -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock .
make -j [number_of_processor_cores] # eg. make -j 4
sudo make install
The installed hhvm binary can be found in /usr/local/bin
That's easy to do with the built-in PHP buildpack. Simply specify a dependency on HHVM in your composer.json file, like below:
{
"require": {
"hhvm": ">=3.5"
}
}
报告相同问题?