intruxxer
12/4/2015 - 4:53 AM

CodeIgniter with Apache & HHVM as FastCGI

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