Friday, May 17, 2013

Install HHVM (Hiphop PHP) on Centos 6.4 (64-bit)

UPDATED: 10/July/2013 - Fixed the errors which are causing repo not available. Sorry for the trouble.

UPDATEd: 19/Oct/2013 - HHVM 2.2.0 Release is available now

UPDATED: 18/Dec/2013 - HHVM 2.3.0 Release is available now  

UPDATED: 14/Apr/2014 - HHVM 3.0.1 Release is available now

I have created a repository and compiled HHVM (v2 of HPHP) rpm packages. Follow these steps to get started.

1. Install Centos 6.x (minimal is preferred)

2. Install epel repository

sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

(or get the latest version from http://ftp.riken.jp/Linux/fedora/epel/6/i386/repoview/epel-release.html)

3. download the hop5 repository configuration file

cd /etc/yum.repos.d

sudo wget http://www.hop5.in/yum/el6/hop5.repo
 
If you are here after Mar-2014, use hhvm as package name instead of hiphop-php

4. Install hiphop-php
sudo yum install hiphop-php

5. Follow the instructions at https://github.com/facebook/hiphop-php to get started


Please note that, i have compiled the required rpms from fedora distribution. DO NOT FILE ANY BUGS WITH CENTOS/FEDORA regarding the rpms that you are about to install from this repoisitory.

67 comments:

  1. http://www.hop5.in/yum/el6/hop5.repo
    No Route to host ....

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. due to iptables. fixed them. please try and let me know.

    ReplyDelete
    Replies
    1. I have installed with succes:
      Package hiphop-php-2.1.210-1.el6.x86_64 installed

      Now, how can i access the hhvm?
      Thanks

      Delete
    2. its in /usr/bin/hhvm

      /usr/bin/hhvm --help will throw the options. read more docs on facebook wiki to get started

      Delete
    3. Yes it is :)
      Thanks for your GREAT WORK, you saved me hours of work.

      Delete
    4. you are welcome :-)

      Delete
  5. Could your provide the srpm for hiphop and gcc i need to rebuild for centos 5, i can manage other dependencies. Thank you.

    ReplyDelete
  6. www.hop5.in/yum/el6/hphp.spec get the spec file here, it has instructions on the top.

    In case you want srpms get them from here http://www.hop5.in/yum/el6/srpms/files.txt

    ReplyDelete
  7. you are welcome Sunny.

    ReplyDelete
  8. Any reason why this uses libmemcached 0.49 and not a more recent version?

    ReplyDelete
  9. Originally, i've compiled against 1.x. But, things didn't seem stable. so switched to the recommended version.

    ReplyDelete
  10. Thanks a lot for your .spec file.
    i've added a BuildRequires cmake >= 2.8.5

    Also, even if glog and glog-devel are installed, I have this error on compil (on Centos 6.4) :
    undefined reference to `google::LogMessage::stream()'

    Any idea ?

    ReplyDelete
    Replies
    1. can you post the list of hhvm dependencies against which you are compiling ? that might help.

      Delete
  11. 502 Bad Gateway whenever i try to wget http://www.hop5.in/yum/el6/hop5.repo - any mirror available?

    ReplyDelete
  12. 502 Bad Gateway when I try to wget http://www.hop5.in/yum/el6/hop5.repo - tried multiple internet connections. Any mirrors available?

    ReplyDelete
  13. I'm stuck at trying to access:
    http://www.hop5.in/yum/el6/hop5.repo

    502 Bad Gateway

    Is there an alternative link? Thanks!

    ReplyDelete
  14. fixed server. please try now.

    ReplyDelete
  15. I still get the bad gaeway error.

    ReplyDelete

  16. [root@root]# sudo hhvm -m server
    mapping self...
    mapping self took 0'00" (41620 us) wall time
    loading static content...
    searching all files under source root...
    analyzing 7 files under source root...
    loaded 0 bytes of static content in total
    loading static content took 0'00" (8959 us) wall time
    could not allocate 1210056703 bytes for translation cache

    Can you help me with this., thanks where is the config file so i can change the default cache value, i am doing this on my test vps first so i can use it on prod server later on .

    anyways thanks for your blog, its really very helpful to get going.

    ReplyDelete
    Replies
    1. Create a configuration file and specify lower translation cache and pass it on to your hhvm with --config option. for example

      hhvm -m server --config /tmp/config.hdf

      or

      add more swap to your linux server (for the time being, if you are on amazon free instance). which will fix that translation cache error.

      Delete
    2. i found solution here

      https://www.facebook.com/hphp/posts/10151262575779326

      i created issue at their github here
      https://github.com/facebook/hiphop-php/issues/1037

      Thanks

      Delete
    3. Specifically, default values are

      Eval {
      JitASize = 536870912 #512MB
      JitAStubsSize = 536870912 #512MB
      JitGlobalDataSize = 134217728 #128MB
      }

      So, change them and put it in a config file and pass it to hhvm.

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. http://www.hop5.in/yum/el6Server/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: hop5. Please verify its path and try again

    ReplyDelete
    Replies
    1. Could you change the contents of hop5.repo to point to this as i currently have rpms only for centos 6

      [hop5]
      name=Hiphop For PHP 6 - Base
      baseurl=http://www.hop5.in/yum/el6/
      gpgcheck=0
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-HOP5

      Delete
  19. sudo yum install ./epel-release-6-8.noarch.rpm

    ends up in the following error:

    Examining ./epel-release-6-8.noarch.rpm: epel-release-6-8.noarch
    Marking ./epel-release-6-8.noarch.rpm to be installed
    Resolving Dependencies
    --> Running transaction check
    ---> Package epel-release.noarch 0:6-8 will be installed
    --> Processing Conflict: epel-release-6-8.noarch conflicts fedora-release
    No package matched to upgrade: epel-release
    --> Finished Dependency Resolution
    Error: epel-release conflicts with fedora-release-19-4.noarch

    How can I work around that?

    ReplyDelete
    Replies
    1. epel is required only if you are centos/redhat distributions. Looks like you are using Fedora (due to the presence of fedora-release package).

      Currently, i have not tested the packages on Fedora (as all the package versions will be different). I'd suggest create a centos6 VM (use virtualbox) and inside the VM, try the steps. It should work.

      Delete
  20. Naresh, I installed on Ubuntu no worries. Am changing my server to centOS 6.4 and will be using this for the HHVM install. In the hope that you are quite the expert on HHVM I'm just pointing you to 2 questions I put forward on github. If you know anything about them please help, if not no worries :-)

    https://github.com/facebook/hhvm/issues/1202
    https://github.com/facebook/hhvm/issues/1206

    ReplyDelete
    Replies
    1. For https://github.com/facebook/hhvm/issues/1206 . Compile your project into single hhbc file and run your project in repo-authoritative mode. Every new build can create a new hhbc file. This is like pre-compiled version of your code and prevents any source code modifications in production.

      https://github.com/facebook/hhvm/issues/1202 hhvm has really basic web-server and supports basic rewrite. Put nginx in front of hhvm to make it really configurable.

      Delete
  21. Tried to install, I am seeing the following on CentOS 6.4:

    Error: Package: snapper-0.1.6-2.1.x86_64 (@filesystems_snapper)
    Requires: libboost_system-mt.so.5()(64bit)
    Removing: boost-system-1.41.0-17.el6_4.x86_64 (@updates)
    libboost_system-mt.so.5()(64bit)
    Updated By: boost-system-1.50.0-1.el6.x86_64 (hop5)
    Not found
    Available: boost-system-1.41.0-11.el6_1.2.x86_64 (base)
    libboost_system-mt.so.5()(64bit)
    Available: boost-system-1.41.0-15.el6_4.x86_64 (updates)
    libboost_system-mt.so.5()(64bit)


    Any thoughts?

    ReplyDelete
    Replies
    1. Hello,

      Could you remove snapper package and try installing the hiphop-php package. Looks like the snapper package was built with lower version of boost (the one that comes with centos). But, hhvm requires higher version of boost package.

      Best.

      Delete
  22. When are you going to compile the latest version that facebook released today?

    ReplyDelete
    Replies
    1. I am working on it. hhvm 2.3.0 needs gcc 4.7 or higher. Just now i have compiled gcc 4.8.2 for centos 6.4. HHVM should be available sometime this week.

      Delete
  23. Hello,

    fail to `sudo wget http://www.hop5.in/yum/el6/hop5.repo`

    http://www.hop5.in/ is now 404 not found.
    Could you update to the domain?

    ReplyDelete
    Replies
    1. switched providers. dns got messed up. please try now.

      Delete
  24. Not able to access the repo, no route to host. :(

    ReplyDelete
    Replies
    1. switched providers. dns got messed up. please try now.

      Delete
  25. "Nice blog.. Thanks for sharing this blog information with us…

    php

    ReplyDelete
  26. Naresh, could you help me out setting HHVM up with Apache? Supporting multiple domains etc.
    I couldn't get it working...

    ReplyDelete
    Replies
    1. Hello Tamer,

      HHVM currently has fastcgi implementation. Have you looked at the instructions available at http://www.hhvm.com/blog/1817/fastercgi-with-hhvm ?

      AFAIK, Multi-domain support in HHVM are a WIP (though there are virtualhosts support) . Try to see if you can use http://httpd.apache.org/docs/2.2/vhosts/mass.html and fastcgi to get things working..

      Let me know if you need anything else, i'll try to answer those.

      Delete
    2. Naresh, I have tried everything on the internet so far. All I get are Internal Server Errors.

      I installed hhvm through yum install hhvm and your repo.
      Then I installed apache with mod_fcg through: yum install httpd mod_fcgid.

      I was not able to find on how to install mod_fastcgi on Apache, there is simply no documentation about installing this module on CentOS apache.

      My hhvm.hdf config file is as follow:
      http://paste.ee/p/xBKmR

      Then I run the HHVM server by executing this command:
      /usr/bin/hhvm --mode daemon --user web --config /etc/hhvm.hdf -vServer.Port=9000 -vServer.Type=fastcgi

      My Apache config for an example host is as follow:
      http://paste.ee/p/fVBOW

      All I get are Internal Server Errors. HHVM is running correctly I assume.

      Note that I am on CentOS 6.5.

      Thanks again.

      Delete
    3. Please follow http://nareshv.blogspot.com/2014/02/configure-hhvm-with-apache-fastcgi-on.html

      Delete
  27. Since to the update to version HHVM-2.4.0-0-gc82fcd8e6199c500454b1a8b930a876ef2c1522b my wordpress blog will not show it's index anymore...
    If I visit the page with my browser I simply get a blank page but if I manually compile the page from command line I get the following error "HipHop Fatal error: Unexpected object type stdClass. in .../wp-includes/functions.php on line 130". I can browse as always the Admin Panel and I already tried changing the theme and disabling all the plugins...
    I'm using Wordpress 3.8.1...
    Do you have any idea on what's going on?

    ReplyDelete
    Replies
    1. Looks like there is a bug in hhvm.

      In the wp-includes/functions.php change line 127 (wordpress 3.8.1 fresh download)

      Change

      $date_object = date_create( null, $timezone_object );

      to

      $date_object = date_create( "now", $timezone_object );

      I have tested this locally and seem to work fine.

      Delete
    2. Thank you very much, now it's working...
      Very strange bug, from what I understood HHVM throws an error when trying to manipulate an object that hasn't been initialized... Am I right?

      Delete
    3. Technically yes, But the bug is due to Zend Vs HHVm Implementation difference. I've filed a bug on your behalf https://github.com/facebook/hhvm/issues/1796 see that for some more details and actual fix if you are interested in.

      cheers!

      Delete
  28. Hey naresh,

    Trying to install hhvm cause a multilib protection error

    Protected multilib versions: libstdc++-4.8.2-8.el6.x86_64 != libstdc++-4.4.7-4.el6.i686
    Protected multilib versions: libgcc-4.8.2-8.el6.x86_64 != libgcc-4.4.7-4.el6.i686

    Is there by chance you will i the future provide i686 build of stdc and libgcc, so as e wont need to do a "-setopt=protected_multilib=false" ? :)

    Thanks!

    ReplyDelete
    Replies
    1. Hi Anthony,

      I have very limited resources to maintain hhvm. If i include i686 also, then its going to be bit more problematic for me to manage. I'll try to see, but cannot promise anything. Hope you understand.

      Thanks.

      Delete
  29. --> Finished Dependency Resolution
    Error: Package: gnote-0.6.3-3.el6.x86_64 (@base/$releasever)
    Requires: libboost_filesystem-mt.so.5()(64bit)
    Removing: boost-filesystem-1.41.0-17.el6_4.x86_64 (@updates)
    libboost_filesystem-mt.so.5()(64bit)
    Updated By: boost-filesystem-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Available: boost-filesystem-1.41.0-18.el6.x86_64 (base)
    libboost_filesystem-mt.so.5()(64bit)
    Available: boost-filesystem-1.50.0-1.el6.x86_64 (hop5)
    Not found
    Error: Package: gnote-0.6.3-3.el6.x86_64 (@base/$releasever)
    Requires: libboost_system-mt.so.5()(64bit)
    Removing: boost-system-1.41.0-17.el6_4.x86_64 (@updates)
    libboost_system-mt.so.5()(64bit)
    Updated By: boost-system-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Available: boost-system-1.41.0-18.el6.x86_64 (base)
    libboost_system-mt.so.5()(64bit)
    Available: boost-system-1.50.0-1.el6.x86_64 (hop5)
    Not found
    Error: Package: akonadi-1.2.1-2.el6.x86_64 (@base/$releasever)
    Requires: libboost_program_options-mt.so.5()(64bit)
    Removing: boost-program-options-1.41.0-17.el6_4.x86_64 (@updates)
    libboost_program_options-mt.so.5()(64bit)
    Updated By: boost-program-options-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Available: boost-program-options-1.41.0-18.el6.x86_64 (base)
    libboost_program_options-mt.so.5()(64bit)
    Available: boost-program-options-1.50.0-1.el6.x86_64 (hop5)
    Not found
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest


    This is the rror i am getting can you please help me with this?

    ReplyDelete
    Replies
    1. Matthew, I'd suggest installing hhvm on a vm first. It uses higher versions of boost/gcc packages which will conflict with other packages in the system.

      In order to continue on your current system, you need to remove "gnote" package 'yum remove gnote' and then install the hhvm packages. But, i'd not recommend this if the gnote app is heavily used by you.

      Cheers !

      Delete
  30. Hi Naresh,

    is it possible you could have a look on this issue thanks

    https://github.com/facebook/hhvm/issues/2129

    ReplyDelete
  31. Hi Naresh,

    Thanks for the CentOS repo, installation of HHVM was a breeze! Not meaning to rush you, do you have plans to bump HHVM to the 3.0.0 release and if so, do you have somewhat of an ETA?

    ReplyDelete
    Replies
    1. Hello Bas,

      Thanks for that.

      Yea, i am closely watching 3.x release, Looks its only FastCGI based. I'll try to spin something, may be in the next couple of days.

      Cheers!

      Delete
    2. Hi Naresh, any update on the 3.0.0 release for CentOS?

      Best,
      Tommy.

      Delete
  32. Error: Package: hhvm-3.0.1-3.el6.x86_64 (hop5)
    Requires: libdwarf >= 20130729-1.el6
    Installed: libdwarf-20120410-2.el6.x86_64 (@hop5)
    libdwarf = 20120410-2.el6

    Hi, not sure where you're getting your libdwarf from, but hop5 doesn't have a high enough version with -3

    ReplyDelete
  33. Hey, my bad, I didn't have EPEL on, found it in there

    ReplyDelete
  34. I have a lot of dependencies problems:

    Error: Package: hiphop-php-2.2.0-1.el6.x86_64 (hop5)
    Requires: libboost_system.so.1.50.0()(64bit)
    Available: boost-system-1.50.0-1.el6.x86_64 (hop5)
    libboost_system.so.1.50.0()(64bit)
    Available: boost-system-1.41.0-18.el6.i686 (base)
    Not found
    Installing: boost-system-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Error: Package: hiphop-php-2.2.0-1.el6.x86_64 (hop5)
    Requires: libboost_regex.so.1.50.0()(64bit)
    Available: boost-regex-1.50.0-1.el6.x86_64 (hop5)
    libboost_regex.so.1.50.0()(64bit)
    Available: boost-regex-1.41.0-18.el6.i686 (base)
    Not found
    Installing: boost-regex-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Error: Package: hiphop-php-2.2.0-1.el6.x86_64 (hop5)
    Requires: libboost_filesystem.so.1.50.0()(64bit)
    Available: boost-filesystem-1.50.0-1.el6.x86_64 (hop5)
    libboost_filesystem.so.1.50.0()(64bit)
    Available: boost-filesystem-1.41.0-18.el6.i686 (base)
    Not found
    Installing: boost-filesystem-1.54.0-7.el6.x86_64 (hop5)
    Not found
    Error: Package: hiphop-php-2.2.0-1.el6.x86_64 (hop5)
    Requires: libboost_program_options.so.1.50.0()(64bit)
    Available: boost-program-options-1.50.0-1.el6.x86_64 (hop5)
    libboost_program_options.so.1.50.0()(64bit)
    Available: boost-program-options-1.41.0-18.el6.i686 (base)
    Not found
    Installing: boost-program-options-1.54.0-7.el6.x86_64 (hop5)
    Not found
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest

    I'm running CentOS release 6.5 (Final) with PHP5.5, any advice

    ReplyDelete
    Replies
    1. Hello ReynerPM,

      Older package was called hiphop-php. Later it was renamed to hhvm to be inline with the facebook's project name change.

      I have updated the post to use "hhvm" as the package for the current release.

      For now, in order to get out of the dependency hell, please do "sudo yum install hhvm" and you should be good. Let me know if things still doesn't work.

      Cheers !
      Naresh

      Delete
  35. When I install hhvm-pgsql i get the following error
    ---> Package hhvm-pgsql.x86_64 0:3.0.1-3.el6 will be installed
    --> Processing Dependency: hhvm = 3.0.1-3.el6 for package: hhvm-pgsql-3.0.1-3.el6.x86_64
    --> Processing Dependency: postgresql92-libs >= 9.2.8-1PGDG.rhel6 for package: hhvm-pgsql-3.0.1-3.el6.x86_64

    It appears that the hhvm-pgsql is not compatilbe with the hhvm version in your repo. Can you fix please?

    Thanks!
    Shawn

    ReplyDelete
  36. Nice article thanks for given this information. i hope it useful to many pepole.more php jobs in hyderabad.

    ReplyDelete