Heim  >  Artikel  >  Backend-Entwicklung  >  windows7x64 apache php环境搭建

windows7x64 apache php环境搭建

WBOY
WBOYOriginal
2016-08-08 09:20:251020Durchsuche

php的在windows上的运行环境每次搭建一次脱层皮,各种折腾。
主要原因:

  • apache server默认不支持windows
  • php有好多个版本,下载下来不一定支持apache
  • 都下载对了,还要配置php和apache

1、下载php
必须为thread safe版,否则没有php5apache2_4.dll,无法与apache集成。
同时要看下php提供的apache的dll的版本,方便下载对应版本的apache
2、下载支持windows的apache服务器
apache服务器,默认是不支持windows的,只提供源码包,下载下来自己编译,在linux上方便多了,在windows上,恶梦。
apache官方说明,有第三方组织,自愿编译提供windows版本的apache,可以找到后下载。
apache下载页
这个组织ApacheHaus的就不错
下载后解压,修改配置文件
#httpd-2.4.16-x64-vc11\Apache24\conf
# 默认的Define SRVROOT "/Apache24"改为自己的apache目录
Define SRVROOT "E:\\php\\httpd-2.4.16-x64-vc11\\Apache24"
ServerRoot "${SRVROOT}"

启动apache
httpd-2.4.16-x64-vc11\Apache24\bin\httpd.exe
访问 http://127.0.0.1
只要能出页面就表示服务器正常。
3、配置php
复制一份php.ini-development,改为php.ini即可,若用到数据库等扩展,稍后再改。
date.timez

4、配置apache
# 默认的Define SRVROOT "/Apache24"改为自己的apache目录
Define SRVROOT "E:\\php\\httpd-2.4.16-x64-vc11\\Apache24"
ServerRoot "${SRVROOT}"

#define  php.ini
PHPIniDir  "E:\\php\\php-5.6.11-Win32-VC11-x64"


LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module E:\\php\\php-5.6.11-Win32-VC11-x64\\php5apache2_4.dll
#define  php.ini
PHPIniDir "E:\\php\\php-5.6.11-Win32-VC11-x64\\"
DocumentRoot "E:\\php\\wwwroot"
<directory>
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php
</directory>

5、phpinfo()
#wwwroot\phpinfo.php

<?php phpinfo();
?>

访问测试。

以上就介绍了windows7x64 apache php环境搭建,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

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图片等比例缩放Nächster Artikel:Nginx之红黑树