2

我知道 HHVM 可以运行常规的 PHP 代码。我想知道的是,我是否可以通过常规解释器提供所有用 .php 编写hack的文件和所有用 PHP 编写的文件的方式进行迁移。HHVMPHP

我认为这应该可以通过使用两个不同的文件扩展名(比如.hh.php)然后以某种方式将它们映射到两个不同的解释器/虚拟机和一些 nginx 设置,不是吗?

4

1 回答 1

3

即使您要求使用 nginx,这里是一个示例(未经测试)Apache CGI 配置:

(对不起,我不知道 nginx)

<IfModule mod_fcgid.c>
    IdleTimeout 3600
    ProcessLifeTime 7200
    MaxProcessCount 64
    DefaultMaxClassProcessCount 8
    IPCConnectTimeout 300
    IPCCommTimeout 7200
    BusyTimeout 300

    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>

    ScriptAlias /php-5.5.10-bin/ /opt/php/5.5.10/bin/
    ScriptAlias /php-5.4.17-bin/ /opt/php/5.4.26/bin/
    ScriptAlias /php-5.3.27-bin/ /opt/php/5.3.28/bin/
    ScriptAlias /php-5.2.17-bin/ /opt/php/5.2.17/bin/

    <Directory "/opt/php">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    <FilesMatch ".+\.hh$">
        SetHandler application/x-httpd-hhvm
    </FilesMatch>

    ScriptAlias /hhvm-2.4.2-bin/ /opt/hhvm/2.4.2/bin/

    <Directory "/opt/hhvm">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>

和虚拟主机:

<VirtualHost *:80>
    ServerAdmin hosting@example.com
    ServerName www.example.com
    ServerAlias example.com

    DocumentRoot /var/deployments/www.example.com/public
    <Directory /var/deployments/www.example.com>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
        Action application/x-httpd-php /php-5.5.10-bin/php-cgi
        Action application/x-httpd-hhvm /hhvm-2.4.2-bin/hhvm-cgi
    </Directory>

    ErrorLog /var/deployments/$serverName/log/www.example.com.error.log
    LogLevel warn
    CustomLog /var/deployments/$serverName/log/www.example.com.access.log combined
</VirtualHost>
于 2014-03-26T00:51:03.263 回答