Skip to content

Instantly share code, notes, and snippets.

@shivaas
Last active March 13, 2018 16:08
Show Gist options
  • Save shivaas/9354045 to your computer and use it in GitHub Desktop.
Save shivaas/9354045 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
@integrii
Copy link

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment