Skip to content

Instantly share code, notes, and snippets.

@colin-kiegel
Created March 30, 2015 16:13
Show Gist options
  • Save colin-kiegel/a9d7045a73a715ce2478 to your computer and use it in GitHub Desktop.
Save colin-kiegel/a9d7045a73a715ce2478 to your computer and use it in GitHub Desktop.
HHVM PreCompile-Script for RepoAuthoritative Mode
#!/bin/bash
# CONFIGURATION: #############
echo "You need to edit this script before running it the first time."
exit # remove this line after finishing your configuration
WWW_DIR="/www/pub/ilias-trunk"
FILE_MASK="\\*.php"
INDEX_TMP="/var/run/hhvm/precompiled/fileindex"
REPO_DIR="/var/run/hhvm/precompiled"
WWWDATA="www-data:www-data"
##############################
# not needed - Workaround for https://github.com/facebook/hhvm/issues/2604
# WWW_RELDIR=".."${WWW_DIR}
echo "make sure $REPO_DIR is writable - or change this script to point to a different path"
# generating list of all php-files
cd /tmp && sudo find $WWW_DIR -name \*.php > $INDEX_TMP
ls -lh $INDEX_TMP
# .. recompiling bytecode repository
# sudo service hhvm stop
echo "WARNING: This requires some Gigabytes of RAM - make there is enough swap ;-)"
sudo hhvm --hphp -thhbc -o $REPO_DIR --input-list $INDEX_TMP
sudo chown $WWWDATA $REPO_DIR/hhvm.hhbc
ls -lh $REPO_DIR/hhvm.hhbc
sudo service hhvm restart
echo ""
echo "don't forget to add the following lines to /etc/hhvm/php.ini (on Ubuntu)"
echo " hhvm.repo.authoritative = true"
echo " hhvm.repo.central.path = $REPO_DIR/hhvm.hhbc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment