Deploying Symfony2 on HHVM + Apache + fastCGI
Asked Answered
G

1

6

I am attempting to deploy a Symfony2 (2.4) app on HHVM (3.0) and Apache (2.4) via fastCGI, as per the instructions here - https://github.com/facebook/hhvm/wiki/FastCGI

While I can properly execute single php files this way, it does not seem to work with the Symfony2 routing system. The routes are properly resolved (e.g. localhost/myapp/web/app_dev.php/my/route/to/something), but the pages themselves do not load. Instead, the page simply outputs "not found", and HHVM logs the following:

Nothing to do. Either pass a .php file to run, or use -m server

Which seems indicative that it believes it has not been passed a proper php file.

It should be noted that deployment worked fine using the built-in webserver that came with HHVM 2.x. This server, however, is no longer supported as of HHVM 3.0.

I am at quite a loss as to what configurations to change in order to make this work. Even pointers leading to this being properly resolved would be a good answer.

Gridley answered 3/4, 2014 at 4:35 Comment(0)
G
5

Finally manage to resolve (most!) of this by using the following configuration file:

Eval {
    Jit = true
    JitWarmupRequests = 1
}

Log {
    Level = Info
    Header = true

    UseLogFile = true
    File = /var/log/hhvm_error.log

    Access {
        * {
            File = /var/log/hhvm_access.log
        }
    }
}

Server {
    IP = 127.0.0.1
    Port = 9000
    ThreadCount = 77

    # Change to match your local root 
    SourceRoot = /opt/lampp/htdocs/

    MaxPostSize = 65  # in MB
}

VirtualHost {
 * {
   Pattern = .*
   RewriteRules {
      * {
        pattern = .?

        # change to app.php for production use
        to = app_dev.php

        # append the original query string
        qsa = true
      }
   }
 }
}

Stats {
    Web = true
    Memory = true
    SQL = true
}

Http {
    DefaultTimeout = 5          
    SlowQueryThreshold = 5000
}

This is based on a config for HHVM 2.* which I found here: http://labs.qandidate.com/blog/2013/10/21/running-symfony-standard-on-hhvm/

In addition, if you are using Doctrine, you will have to modify your dependencies in order to get it working properly with HHVM due to a previous bug: Symfony2 and HHVM Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible

Gridley answered 3/4, 2014 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.