hhvm> Postgres适用于CLI,而非NGINX

时间:2014-08-13 02:32:39

标签: postgresql nginx hhvm

我正在运行hhvm 3.2.0并且我正在尝试设置Postgres部分。我们加载了扩展,它在CLI上运行时有效,但是当我通过浏览器通过NGINX运行时,没有任何内容,没有输出,任何日志中都没有行(HHVM / NGINX / System)

安装并更新了必备的libpq。

我的预感是它与fastCGI有关,但Wordpress运行正常,所以我现在迷路了。

有人能指出我找出问题的方向吗?提前谢谢!

这就是我所拥有的:

root@ip-172-31-2-84:~# php -v
HipHop VM 3.2.0 (rel)
Compiler: tags/HHVM-3.2.0-0-g01228273b8cf709aacbd3df1c51b1e690ecebac8
Repo schema: c52ba40f4a246d35a88f1dfc1daf959851ced8aa

/etc/hhvm/config.hdf:

DynamicExtensionPath = /data/config/etc/hhvm/extensions
DynamicExtensions {
    * = pgsql.so
}

conf.d / hhvm.conf:

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

fastcgi_params:

fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_script_name;
fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

pgsql.so来自https://github.com/PocketRent/hhvm-pgsql/tree/releases/3.2.0/ubuntu/trusty

PHP文件测试全部:(k.hh)

if (extension_loaded('pgsql')) {

echo "hello pgsql";
try{
   $db = pg_connect( "host=xxxxxxx.rds.amazonaws.com port=5432 dbname=production user=dbu password=xxxxx" );
   var_dump($db);
}
   catch (Exception $e) {
      echo $e->getMessage();
   }
}else{
   echo "no pgsql";
}

从CLI运行:

root@ip-172-31-2-84:~# hhvm /var/www/medic52.com/www/k.hh
hello pgsqlresource(4) of type (pgsql connection)

在网络上相当: http://www.medic52.com/k.hh

NGINX access.log确认服务器错误:

17.124.20.86 - - [12/Aug/2014:05:54:28 +0000] "GET /k.hh HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" "-"

0 个答案:

没有答案