Facebook 在以前的 HPHPc, HPHPi 和 HPHPd 的基础上开发了一套全新的 HipHop VM for PHP (HHVM),使用 JIT(Just-In-Time)编译技术可以快速生成代码和即时编译。据 Facebook 称,HHVM 的性能是 Zend PHP 5.2 的5倍多,更重要的是 HHVM 是开源的~ 现在运行
Facebook 在以前的 HPHPc, HPHPi 和 HPHPd 的基础上开发了一套全新的 HipHop VM for PHP (HHVM),使用 JIT(Just-In-Time)编译技术可以快速生成代码和即时编译。据 Facebook 称,HHVM 的性能是 Zend PHP 5.2 的5倍多,更重要的是 HHVM 是开源的~
现在运行 WordPress/Drupal 等流行 PHP 应用程序的流行环境搭配是 Nginx/Apache + MySQL + PHP,我们来看看 HHVM 这个神器能不能搞定 WordPress. HHVM 可以当作一个独立服务器使用,不需要搭配其他的 web 服务器。
首先更新系统(这里采用 Ubuntu Server 12.04 LTS 版本)和升级,然后后安装 php, mysql(hhvm 可以单独运行,不需要安装 apache):
$ sudo apt-get update && apt-get upgrade $ sudo apt-get install mysql-client mysql-common mysql-server php5 php5-cli php5-common php5-cgi php5-mysql
加入 hiphop 源,更新后安装 hiphop-php:
$ sudo echo "deb http://dl.hiphop-php.com/ubuntu precise main" >> /etc/apt/sources.list $ sudo apt-get update $ sudo apt-get install hiphop-php
创建 wordpress 所需要的数据库:
$ mysql -uroot -proot mysql> create database wordpress; mysql> Bye
下载 wordpress 后解压、修改配置文件连上数据库:
$ cd /var/www $ sudo wget http://wordpress.org/latest.tar.gz $ sudo tar -zxf latest.tar.gz $ sudo chown -R www-data:www-data wordpress $ cd wordpress $ sudo cp wp-config-sample.php wp-config.php $ sudo vi wp-config.php ... /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', 'root'); ...
修改 wp-db.php:
$ sudo vi wp-includes/wp-db.php ... /** * @since 0.71 */ //define( 'OBJECT', 'OBJECT', true ); define( 'OBJECT', 'OBJECT' ); define( 'Object', 'OBJECT' ); define( 'object', 'OBJECT' ); ...
配置 hhvm(只需要加一个配置文件就行):
$ sudo vi /etc/hhvm.hdf Server { Port = 80 SourceRoot = /var/www/ } Eval { Jit = true } Log { Level = Error UseLogFile = true File = /var/log/hhvm/error.log Access { * { File = /var/log/hhvm/access.log Format = %h %l %u %t \"%r\" %>s %b } } } VirtualHost { * { Pattern = .* RewriteRules { dirindex { pattern = ^/(.*)/$ to = $1/index.php qsa = true } } } } StaticFile { FilesMatch { * { pattern = .*\.(dll|exe) headers { * = Content-Disposition: attachment } } } Extensions { css = text/css gif = image/gif html = text/html jpe = image/jpeg jpeg = image/jpeg jpg = image/jpeg png = image/png tif = image/tiff tiff = image/tiff txt = text/plain } }
创建运行 hhvm 所需的 log 目录,运行 hhvm:
$ sudo mkdir /var/log/hhvm/ $ sudo /usr/bin/hhvm --mode daemon --user www-data --config /etc/hhvm.hdf
用浏览器访问 http://IP address/wordpress/ 就应该可以看到 wordpress 安装界面了,按提示安装完后使用一下,看看有啥问题。同时检查一下 hhvm 日志,看看是否有访问纪录:
$ sudo tail /var/log/hhvm/access.log
原文地址:使用 HHVM 运行 WordPress, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.