简体   繁体   English

在HHVM + Apache + fastCGI上部署Symfony2

[英]Deploying Symfony2 on HHVM + Apache + fastCGI

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 我试图通过fastCGI在HHVM(3.0)和Apache(2.4)上部署Symfony2(2.4)应用程序,按照此处的说明 - 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. 虽然我可以通过这种方式正确执行单个php文件,但它似乎不适用于Symfony2路由系统。 The routes are properly resolved (eg localhost/myapp/web/app_dev.php/my/route/to/something), but the pages themselves do not load. 路由已正确解析(例如localhost / myapp / web / app_dev.php / my / route / to / something),但页面本身不会加载。 Instead, the page simply outputs "not found", and HHVM logs the following: 相反,页面只输出“未找到”,HHVM记录以下内容:

Nothing to do. 没事做。 Either pass a .php file to run, or use -m server 要么传递.php文件来运行,要么使用-m server

Which seems indicative that it believes it has not been passed a proper php file. 这似乎表明它认为它没有通过正确的PHP文件。

It should be noted that deployment worked fine using the built-in webserver that came with HHVM 2.x. 应该注意的是,部署使用HHVM 2.x附带的内置Web服务器工作正常。 This server, however, is no longer supported as of HHVM 3.0. 但是,从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. 即使是能够正确解决这一问题的指针也是一个很好的答案。

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/ 这是基于我在这里找到的HHVM 2. *的配置: 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 此外,如果您使用的是Doctrine,则必须修改您的依赖项才能使其与HHVM一起正常工作,原因是之前的错误: Symfony2和HHVM Doctrine \\ DBAL \\ Driver \\ PDOConnection :: prepare()声明必须是兼容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM