简体   繁体   English

如何让Apache和PHP交流

[英]How to get Apache and PHP to talk

I have successfully installed both Apache and php on my computer, Now I want to know how to tell Apache what translator it needs to use when it is asked for a .php file by users. 我已经在计算机上成功安装了Apache和php,现在我想知道如何告诉Apache在用户要求提供.php文件时需要使用哪种翻译器。

I tried adding the following code to the end of the httpd.conf file but afterward I was unable to start Apache service. 我尝试将以下代码添加到httpd.conf文件的末尾,但之后我无法启动Apache服务。

AddType application/x-httpd-php .php
PHPIniDir "C:/php5/"
LoadModule php5_module "C:/php5/php5apache2_4.dll"

I get "the requested operation has failed!" 我收到“请求的操作失败!” error when I try to start apache service from apache service monitoring tool. 尝试从apache服务监视工具启动apache服务时出现错误。

Thanks in advance. 提前致谢。

  1. Delete your changes and then do almost the same thing but put the rows in the right place. 删除更改,然后执行几乎相同的操作,但将行放在正确的位置。

  2. Search for the LoadModule statements in the httpd.conf-file. 在httpd.conf文件中搜索LoadModule语句。 After the last LoadModule statement paste this: 在最后一个LoadModule语句之后,粘贴以下代码:

    LoadModule php5_module "c:/php/php5apache2_2.dll"

  3. Search for AddType statements. 搜索AddType语句。 After the last one paste this: 最后一个粘贴后:

    AddType application/x-httpd-php .php

  4. Paste this at the very end of your httpd.conf-file: 将此粘贴到您的httpd.conf文件的最后:

    PHPIniDir "c:/php"

Change all instances of c:/php to c:/php5 if that is where you installed php. 如果您在其中安装了php,请将c:/ php的所有实例更改为c:/ php5。

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

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