现在的位置: 首页 > 综合 > 正文

apache2.2.21 + php5.3.8 + mysql5.5配置

2018年01月09日 ⁄ 综合 ⁄ 共 1333字 ⁄ 字号 评论关闭

最近在弄wordpress 需要apache + php ,网上有好多集成apache+php+mysql的工具,自己感觉还是动手自己配置比较好点,尝试很久,终于成功,留以后参考。

一.下载地址:

二.安装:

  • 安装mysql到 D:\Program Files\MySQL目录下
  • 安装apache到 D:\MyWeb\Apache2.2目录下
  • 解压php的zip包到 D:\MyWeb\php目录下

三.配置:

所有程序安装好后,开始配置

1.配置apache支持php

设置php的配置文件php.ini,将php跟目录下(D:\MyWeb\php)的php.ini-development文件重命名为php.ini

打开php.ini,找到如下配置,将extension_dir的值给为"D:/MyWeb/php/ext",并去掉前边的分号。如:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "D:/MyWeb/php/ext"

doc_root是web应用的根目录,改为自己的web目录,如:D:/MyWeb/Apache2.2/htdocs,如:

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
; http://php.net/doc-root
doc_root = "D:/MyWeb/Apache2.2/htdocs"

找到apache的位置文件(D:\MyWeb\Apache2.2\conf.httpd.conf) 配置其支持php

LoadModule php5_module "D:/MyWeb/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
# 配置 php.ini 的路径
PHPIniDir "D:/MyWeb/php"

重启apache配置生效。

2.配置php支持mysql

只需要将php.ini文件中extension=php_mysql.dll前边的分号去掉即可,如下:

;extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
;extension=php_mysqli.dll

至此,配置完毕

抱歉!评论已关闭.