简体   繁体   English

在Windows 8上使用PHP 5.x配置Apache 2.2

[英]Configuring Apache 2.2 with PHP 5.x on Windows 8

I have Windows 8 64 bit, I downloaded Apache 2.2 and PHP 5.53 Thread Safe and put them in "D:/Server" folder. 我有Windows 8 64位,我下载了Apache 2.2和PHP 5.53 Thread Safe,并将它们放在“ D:/ Server”文件夹中。

D:\\Server\\Apache2 d:\\服务器\\的Apache2

D:\\Server\\php d:\\服务器\\ PHP

I copied the file "php.ini-production" in D:\\Server\\php and named it php.ini ; 我将文件“ php.ini-production”复制到D:\\ Server \\ php中,并将其命名为php.ini; The file php5apache2_4.dll exist in D:/Server/php 文件php5apache2_4.dll存在于D:/ Server / php中

Then I edit "D:\\Server\\Apache2\\conf\\httpd.txt": 然后编辑“ D:\\ Server \\ Apache2 \\ conf \\ httpd.txt”:

...
LoadModule php5_module "D:/Server/php/php5apache2_4.dll"
...
AddType application/x-httpd-php .php
...
PHPIniDir "D:/Server/php"

Then I try to restart Apache 2.2 but it pop up en Error window: "The requested operation has failed" (If I omit the first and the thirs declerations, it does restart...) 然后,我尝试重新启动Apache 2.2,但它又弹出en错误窗口:“请求的操作失败”(如果我省略了第一个和第三个请求,它将重新启动...)

I also tried PHP 5.2.17 that has php5apache2_2.dll file, and it doesn't work.. 我还尝试了具有php5apache2_2.dll文件的PHP 5.2.17,它不起作用。

Thanks for your help! 谢谢你的帮助!

Use AddHandler instead of AddType... Also, windows-style slashes work fine for paths. 使用AddHandler代替AddType ...此外,Windows样式的斜杠对于路径也可以正常工作。

Eg my httpd.conf contains following: 例如,我的httpd.conf包含以下内容:

PHPIniDir "C:\php\"
LoadModule php5_module "C:\php\php5apache2_4.dll"
AddHandler application/x-httpd-php .php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM