Maison  >  Article  >  développement back-end  >  apahce 与 php整合

apahce 与 php整合

巴扎黑
巴扎黑original
2016-11-23 15:08:141064parcourir

整合apache和php 

1.修改apache的配置文件httpd.conf 

1)在httpd.conf文件中找到有很多LoadModule的地方,在最后加上如下语句: 
  LoadModule php5_module E:/soft_work/PHP/php5apache2_2.dll 
  AddType application/x-httpd-php .php 

  PHPIniDir "E:/soft_work/PHP" 

2)修改DirectoryIndex,加上index.php 

3)在apache目录下的htdocs中新建一个目录myphp,然后在该目录下建立一个index.php文件,内容如下: 
 

3)重启apache,然后在浏览器中输入http://localhost/myphp,如果能出结果则表明apache和php整合成功 

补充: 如果想改变站点的目录,修改 httpd.conf 
设置站点根目录,将原来的 
DocumentRoot "E:/soft_work/Apache Http Server/htdocs"改为: 
DocumentRoot "D:/site" 

改为: 
 

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Article précédent:php include 和 require区别Article suivant:php 修改文件中变量