百度开放云 云服务器BCC centos6 yum安装 hhvm教程

百度开放云BCC centos6 yum安装 hhvm教程

添加epel yum源

rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

 

安装hhvm所需要的依赖包

yum -y install libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel mysql-devel \
libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel \
bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel \
libevent-devel libcurl-devel libmemcached-devel

添加gleez yum源(官方地址被墙)

rpm -Uvh http://blog.linuxeye.com/wp-content/uploads/2014/05/gleez-repo-6-0.el6.noarch.rpm

添加remi yum源

rpm -Uvh http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6.5-1.el6.remi.noarch.rpm

从remi安装hhvm依赖包

yum -y --enablerepo=remi install libwebp mysql mysql-devel mysql-lib

安装hhvm

yum -y --nogpgcheck install hhvm

查看hhvm版本号

hhvm --version
HipHop VM 3.4.0-dev+2014.09.29 (rel)
Compiler: heads/master-0-gfe70efe4efa8318536ea1d4940362e83e641d905
Repo schema: e3bee358a000cf7efe3a0f9642cdc9b488963dca
Extension API: 20140829

将hhvm加入开机启动

chkconfig hhvm on

配置hhvm

# vi /etc/hhvm/server.ini

;hhvm.server.port = 9001 (注释或者删除此行)
hhvm.server.file_socket = /var/run/hhvm/sock (添加此行,hhvm运行模式由端口改为socket方式)

# vi /etc/hhvm/php.ini在php options下面追加为以下内容,以添加内存限制,关闭expose.

hhvm.mysql.socket =/tmp/mysql.sock
memory_limit = 512M
expose_php = 0

配置nginx:

找到service字段内的php部份,此处在每次添加完虚拟主机以后都要修改.

fastcgi_pass unix:/tmp/php-cgi.sock; (注释此行)
fastcgi_pass unix:/var/run/hhvm/sock; (添加此行)

如:

location ~ \.php{
  root  /usr/share/nginx/html;
  fastcgi_pass unix:/var/run/hhvm/sock;
  fastcgi_split_path_info ^(.+\.php)(.*)$;
  fastcgi_index  index.php;
  fastcgi_param PATH_INFO $fastcgi_path_info;
  fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
  include	fastcgi_params;
    }

重启nginx,启动hhvm.大功告成.

service nginx restart
service hhvm start
service mysqld start
来源: 腾讯云Qcloud评测
日期: 2016-7-9
作者: 腾讯云/服务器VPS推荐评测/Vultr
阅读数: 57
链接到文章: https://ixvps.com/41748.html

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注