Heim  >  Artikel  >  Backend-Entwicklung  >  apahce 与 php整合

apahce 与 php整合

巴扎黑
巴扎黑Original
2016-11-23 15:08:141064Durchsuche

整合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" 

改为: 
 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php include 和 require区别Nächster Artikel:php 修改文件中变量