php hiphop mysql_HipHop PHP实战(详解web运行模式)

Note: These

code examples assume the HipHop compiler is fully built.

1 . Setting Up Your Environment (构建环境)

To get started, you need to configure two environment variables.

cd .. # into the root of the hphp checkout

export HPHP_HOME=`pwd`

export HPHP_LIB=`pwd`/bin

# if you followed the Ubuntu 9.10 instructions, you also need

export CMAKE_PREFIX_PATH=`/bin/pwd`/../

2 . Choosing which Mode to Run HipHop  (HipHop运行模式)

You can run HipHop in 5 different modes. These Hello World examples demonstrate each one. All commands are run from the src/ directory in these examples.

First, create a file called test.php. Populate it with some text, like, “echo Hello, World! > test.php”. Then choose from the following modes:

Mode 1 (直接运行模式): Compiling HipHop and running it directly.

echo "Hello, World!" > test.php

hphp/hphp test.php

Mode 2 (命令行运行编译程序): Compiling HipHop in a temporary directory and running the compiled program from the command line.

hphp/hphp test.php --keep-tempdir=1 --log=3

/tmp/hphp_p6vSsP/program (use your own temporary directory name from output)

--keep-tempdir=1 can

also be specified with -k

1. Note it’s single dash and there is a space, not “=” between “k” and “1”. This is something to watch out when working with boost command line options.

--log=3 outputs

some verbose information, so you can find out which temporary directory it created. You may always specify your own output directory with --output-dir=mypath or -o

mypath.

Mode 3 (使用web 运行编译模程序 ): Compiling HipHop in a temporary directory and running the compiled program as a web server.

hphp/hphp test.php --keep-tempdir=1 --log=3

sudo /tmp/hphp_p6vSsP/program -m server

Then, from another window, run:

curl localhost/test.php

If you don’t want to use sudo, you can run HipHop on port 8080.

hphp/hphp test.php --keep-tempdir=1 --log=3

/tmp/hphp_p6vSsP/program -m server -p 8080

curl http://localhost:8080/test.php

Run this command to administer your server:

curl http://localhost:8080

You can also run the server as a daemon:

sudo /tmp/hphp_p6vSsP/program -m daemon

Mode 4 (直接解释运行): Interpreting HipHop directly.

hphpi/hphpi -f test.php (note the "-f" flag)

Mode

5 (web服务器运行源代码): Starting a Web server or daemon and interpreting HipHop on the fly.

sudo hphpi/hphpi -m server (or daemon)

curl localhost/test.php

curl localhost

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值