window+lighttpd+php 配置说明

原文地址:http://www.iteye.com/topic/186705

 

准备工作:
1 从 lighttpd 的官方网下载window版的exe安装版
2 php 的可以是 window下的安装版或解压版都可以

安装步骤:
1 安装lighttpd,安装到指定目录下比如C:\Server\lighttp1.4.19-1\,本人装的LightTPD-1.4.19-1-Win32-SSL.exe
2 解压或安装php到指定目录下,比如C:/Server/php5/

接下来就是配置了
第一步把 C:\Server\lighttp1.4.19-1\conf\lighttpd-inc.conf打开
把cgi的modules放开
server.modules              = (
                                "mod_access",
                                "mod_accesslog",
                                "mod_alias",
#                               "mod_auth",
                               "mod_cgi",
#                               "mod_cml",
#                               "mod_compress",
#                               "mod_dirlisting",
#                               "mod_evasive",
#                               "mod_evhost",
#                               "mod_expire",
#                               "mod_extforward",
                               "mod_fastcgi",
#                               "mod_flv_streaming",
#                               "mod_indexfile",
#                               "mod_magnet",
#                               "mod_mysql_vhost",
#                               "mod_proxy",
#                               "mod_redirect",
#                               "mod_rewrite",
##                              "mod_rrdtool",
                               "mod_scgi",
#                               "mod_secdownload",
#                               "mod_setenv",
#                               "mod_simple_vhost",
                                "mod_ssi",
#                               "mod_staticfile",
                                "mod_status",
##                              "mod_trigger_b4_dl",
#                               "mod_userdir",
#                               "mod_usertrack",
#                               "mod_webdav"
                               )


#修改这里
cgi.assign                  = ( ".php" => "C:/Server/php5/php-cgi.exe" )

lighttpd的配置先到这里,接下来看看php的配置

php的主要是php.ini文件的配置,它是是否配置成功的关键
cgi.force_redirect = 1
cgi.fix_pathinfo=1
这两个把前面的分号去掉

找到doc_root= 前面加;号
;extension=php_sockets.dll 把分号去掉,其他的dll根据需要去掉分号即可

注:到此为止貌似已经配置完成了,但发现lighttpd的默认虚拟目录是HTDOCS/
这种情况下测试php程序是行不通的,这个可能是个lighttpd的win下的bug吧
所以把虚拟路径改变一下,最好不在安装目录下,比如:server.document-root        = "D:/phpv"

好了 到此为止配置已完成,
启动lighttpd 运行C:\Server\lighttp1.4.19-1\bin\Service-Install.exe
(停止是Service-Remove.exe)或C:\Server\lighttp1.4.19-1\TestMode.bat
可以了
我们在D:/phpv 下建立一个test.php
写入<? phpinfo(); ?>.
访问 http://1270.0.1/test.php
看到php信息页面就是配置成功了

你可能感兴趣的:(C++,c,PHP,cgi,lighttpd)