设置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配置生效。