To get my php projects running as fast as possible om trying to use hhvm.
And here is my small guide how to install it on centos 7
I used the docs from https://github.com/facebook/hhvm/wiki/Building-and-installing-hhvm-on-CentOS-7.x
yum localinstall http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc}-devel \ {sqlite,tbb,bzip2,openldap,readline,elfutils-libelf,gmp,lz4,pcre}-devel \ lib{xslt,event,yaml,vpx,png,zip,icu,mcrypt,memcached,cap,dwarf}-devel \ {unixODBC,expat,mariadb}-devel lib{edit,curl,xml2,xslt}-devel \ glog-devel oniguruma-devel inotify-tools-devel ocaml
yum install ImageMagick-last\* --enablerepo=remi
My box is a clean centos 7. If you have ImageMagic install already uninstall it.
cd /opt git clone https://github.com/facebook/hhvm -b master hhvm --recursive cd hhvm
Time to build
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))
./hphp/hhvm/hhvm --version
sudo make install
First create some folders
mkdir /etc/hhvm mkdir /var/run/hhvm mkdir /var/log/hhvm mkdir /var/tmp/hhvm mkdir -p /usr/share/hhvm/hdf/ chmod 775 /var/run/hhvm chmod 777 /var/tmp/hhvm
Now add some config files
vi /etc/hhvm/server.hdf
PidFile = /var/run/hhvm/pid Server { Port = 9000 SourceRoot = /var/www/ DefaultDocument = index.php } Log { Level = Warning AlwaysLogUnhandledExceptions = true RuntimeErrorReportingLevel = 8191 UseLogFile = true UseSyslog = false File = /var/log/hhvm/error.log Access { * { File = /var/log/hhvm/access.log Format = %h %l %u % t \"%r\" %>s %b } } } Repo { Central { Path = /var/tmp/hhvm/.hhvm.hhbc } } #include "/usr/share/hhvm/hdf/static.mime-types.hdf" StaticFile { FilesMatch { * { pattern = .*\.(dll|exe) headers { * = Content-Disposition: attachment } } } Extensions : StaticMimeTypes } MySQL { TypedResults = false }
and the file
vi /usr/share/hhvm/hdf/static.mime-types.hdf
I added this file https://github.com/hhvm/packaging/blob/master/hhvm/rpm/fedora20/rpmbuild/SOURCES/static.mime-types.hdf
Adding the service
vi /usr/lib/systemd/system/hhvm.service
[Unit] Description=HHVM HipHop Virtual Machine (FCGI) [Service] ExecStart=/usr/local/bin/hhvm --config /etc/hhvm/server.hdf --user nobody --mode daemon -vServer.Type=fastcgi -vServer.Port=9000 [Install] WantedBy=multi-user.target
Enable and start
systemctl enable hhvm
systemctl start hhvm
systemctl status hhvm
Error if not started i had some trying with dirs and permissions test chmod 777 to the dirs and then when it works start tight the perms
tail /var/log/hhvm/error.log