1. 准备好安装包
httpd-2.2.25-win32-x86-openssl-0.9.8y.msi
php-5.4.20-Win32-VC9-x86.zip //http://windows.php.net/downloads/releases/archives/
注意php不能太新了,php4apache2_4.dll不适用此apache版本,出现load model错误
2. httpd.ini文件增加
LoadModule php5_module "F:\php\php5apache2_2.dll"
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php .htm
# configure the path to php.ini
PHPIniDir "F:/php"
ServerRoot "F:/Program Files (x86)/Apache Software Foundation/Apache2.2"
Listen 80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerAdmin 94129057@qq.com
DocumentRoot "F:/brucephp"
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
<Directory "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access.log" common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
LoadModule php5_module "F:\php\php5apache2_2.dll"
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php .htm
PHPIniDir "F:/php"
3. 设置虚拟主机
打开httpd.conf文件,去掉2前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启wamp环境,无法打开localhost,需要在httpd-vhosts.conf配置一下。
<VirtualHost *:80>
ServerAdmin 94129057@qq.com
DocumentRoot "F:/brucephp/public"
#欢迎页面
DirectoryIndex index.php
<Directory "F:/brucephp/public">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName www.qianqian.com
ErrorLog "logs/qianqian-error.log"
CustomLog "logs/qianqian-access.log" common
</VirtualHost>
4. 在host文件中添加虚拟主机
127.0.0.1 localhost
127.0.0.1 www.qianqian.com
127.0.0.1 www.jingdian.com
5. 启动后,查看php信息
echo phpinof(); 放到index.php中
修改F:\php\php.ini 中的include_path,重启apache 服务,即可。
Loaded Configuration File | F:\php\php.ini |
include_path | .;F:\php\includes;F:\tools\webproject\Custom\ZendFramework-1.11.1\library; | .;F:\php\includes;F:\tools\webproject\Custom\ZendFramework-1.11.1\library; |