Archive for April 3rd, 2009

整理一下lighttpd+php在iPhone上的安装的方法

> Win32使用putty,linux和mac osx使用ssh连接到iPhone;

> 安装php和lighttpd;

apt-get update; apt-get install php; apt-get install lighttpd

> 创建布署目录;

mkdir -p /var/www/htdocs

> 修改lighttpd配置;

vi /usr/local/etc/lighttpd.conf

修改:

server.document-root = "/var/www/htdocs"
server.modules = ( "mod_fastcgi" )
server.tag = "lighttpd 1.4.18/PHP 5.2.8 (cgi-fcgi)"   #此处可以随意填写
server.pid-file = "/var/run/lighttpd.pid"
index-file.names = ( "index.php", "index.py", "index.html", "index.htm" ) #根据自己需要填写
static-file.exclude-extensions = ( ".php", ".fcgi", ".cgi", ".py" )
fastcgi.map-extensions = ( ".php3"=>".php" )
fastcgi.server = (
    ".php"=>((
        "host"=>"127.0.0.1",
        "port"=>9000,
        "broken-scriptfilename"=>"enable",
        "fix-root-scriptname"=>"enable"
    ))
)

cgi.assign = (
     ".py" => "/usr/bin/python"  # 如果安装python的话,可以考虑添加这行
)

#其它保持不变
memetype.assign ...

> 运行;

php-cgi -b 127.0.0.1:9000 &

lighttpd -f /usr/local/etc/lighttpd.conf &

> 测试;

echo "<?php phpinfo(); ?>" > /var/www/htdocs/info.php

打开safari,输入地址 http://localhost/info.php

 

以上操作必备条件,jb过的iPhone,已经安装unix subsystem,mobile terminal,cydia,openssl,openssh。