Skip to content

Instantly share code, notes, and snippets.

@kidager
Forked from shivaas/codeigniter-apache-hhvm.md
Created February 1, 2016 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidager/fd4e65860b359a19088c to your computer and use it in GitHub Desktop.
Save kidager/fd4e65860b359a19088c to your computer and use it in GitHub Desktop.
CodeIgniter with Apache & HHVM as FastCGI

Apache Configuration:

<VirtualHost *:80>
  ServerName blah.com

  DirectoryIndex index.html index.php
  ProxyRequests On
  ProxyPreserveHost On
  ProxyVia full

  ProxyPass / fcgi://127.0.0.1:9000/path/to/codeigniter/app/index.php/
</VirtualHost>

HHVM Configuration:

Server {
   Type=fastcgi
   Port=9000
   PathDebug = true
}

VirtualHost {
  * {
    Pattern = .*
    }
}

StaticFile {
  FilesMatch {
    * {
      pattern = .*\.(dll|exe)
      headers {
        * = Content-Disposition: attachment
      }
    }
  }

  Extensions {
    css = text/css
    gif = image/gif
    html = text/html
    jpe = image/jpeg
    jpeg = image/jpeg
    jpg = image/jpeg
    png = image/png
    tif = image/tiff
    tiff = image/tiff
    txt = text/plain
  }
}

ErrorHandling {
    CallUserHandlerOnFatals = true
    NoInfiniteRecursionDetection = false
    ThrowBadTypeExceptions = false
    ThrowTooManyArguments = false
    WarnTooManyArguments = false
    ThrowMissingArguments = false
    ThrowInvalidArguments = false
    EnableHipHopErrors = true
    NoticeFrequency = 1    # 1 out of these many notices to log                                                                                                                                             
    WarningFrequency = 1   # 1 out of these many warnings to log                                                                                                                                            
    AssertActive = false
    AssertWarning = false
  }

Repo {
  Central {
    Path = /var/log/hhvm/.hhvm.hhbc
  }
}

Log {
  Level = Error
  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
    }
  }
}

MySQL {
  TypedResults = false
}

To Run HHVM:

hhvm --mode daemon -vServer.Type=fastcgi -vServer.Port=9000 --config /path/to/hhvm/config/config.hdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment