php开发环境配置及虚拟目录设置
php开发环境配置
--1--apache环境配置:httpd.conf
(1)# LoadModule rewrite_module modules/mod_rewrite.so(注意:是mod_rewrite 前面的"#"去掉)
(2)文档中所有凡是出现 AllowOverride为None
(3)<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all(改为allow from all)
</Directory>
(4)DocumentRoot "C:/wamp/www" apache 配置虚拟路径
注意:请确保路径正确,且路径存在 否则apache不能启动
--apache2.2.22版本保留默认即可
(5)如果此时访问应该会出现权限不够的问题
所以我们还需应用访问的权限AllowOverride到指定的apache配置的虚拟路径下
<Directory "c:/testWeb/public/">
--apache2.2.22版本保留默认即可
--2--php环境配置:php.ini
(1)将library 放置好然后php.ini里配置include library
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;c:\library"
--php5.3.13版本保留默认即可
--3--虚拟目录配置
(1)去掉apache httpd.conf下面两句话前面的#
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
(2)C:\Windows\System32\drivers\etc下找到hosts文件
配置
127.0.0.1 tools.localhost
127.0.0.1 website.localhost
--1--apache环境配置:httpd.conf
(1)# LoadModule rewrite_module modules/mod_rewrite.so(注意:是mod_rewrite 前面的"#"去掉)
(2)文档中所有凡是出现 AllowOverride为None
(3)<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all(改为allow from all)
</Directory>
(4)DocumentRoot "C:/wamp/www" apache 配置虚拟路径
注意:请确保路径正确,且路径存在 否则apache不能启动
--apache2.2.22版本保留默认即可
(5)如果此时访问应该会出现权限不够的问题
所以我们还需应用访问的权限AllowOverride到指定的apache配置的虚拟路径下
<Directory "c:/testWeb/public/">
--apache2.2.22版本保留默认即可
--2--php环境配置:php.ini
(1)将library 放置好然后php.ini里配置include library
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;c:\library"
--php5.3.13版本保留默认即可
--3--虚拟目录配置
(1)去掉apache httpd.conf下面两句话前面的#
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
(2)C:\Windows\System32\drivers\etc下找到hosts文件
配置
127.0.0.1 tools.localhost
127.0.0.1 website.localhost
以下设置虚拟目录:
(3)找到C:\wamp\bin\apache\Apache2.2.11\conf\extra下的httpd-vhost.conf文件
配置如下数据
NameVirtualHost *:80(端口号被占用更改为新的,同时httpd.conf中#Listen 12.34.56.78:80 更改Listen 8080)
<VirtualHost *:8080>
ServerName website.localhost
ServerAdmin webmaster@test.tools.directhr.net
DocumentRoot "C:\Users\n.zhang\Documents\Website\DHR3"
<Directory "C:\Users\n.zhang\Documents\Website\DHR3">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "logs/test.tools.directhr.net-error.log"
CustomLog "logs/test.tools.directhr.net-access.log" common
</VirtualHost>
<VirtualHost *:8080>
ServerName tools.localhost
ServerAdmin webmaster@test.tools.directhr.net
DocumentRoot "C:\Users\n.zhang\Documents\Tools"
<Directory "C:\Users\n.zhang\Documents\Tools">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "logs/test.tools.directhr.net-error.log"
CustomLog "logs/test.tools.directhr.net-access.log" common
</VirtualHost>
(3)找到C:\wamp\bin\apache\Apache2.2.11\conf\extra下的httpd-vhost.conf文件
配置如下数据
NameVirtualHost *:80(端口号被占用更改为新的,同时httpd.conf中#Listen 12.34.56.78:80 更改Listen 8080)
<VirtualHost *:8080>
ServerName website.localhost
ServerAdmin webmaster@test.tools.directhr.net
DocumentRoot "C:\Users\n.zhang\Documents\Website\DHR3"
<Directory "C:\Users\n.zhang\Documents\Website\DHR3">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "logs/test.tools.directhr.net-error.log"
CustomLog "logs/test.tools.directhr.net-access.log" common
</VirtualHost>
<VirtualHost *:8080>
ServerName tools.localhost
ServerAdmin webmaster@test.tools.directhr.net
DocumentRoot "C:\Users\n.zhang\Documents\Tools"
<Directory "C:\Users\n.zhang\Documents\Tools">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "logs/test.tools.directhr.net-error.log"
CustomLog "logs/test.tools.directhr.net-access.log" common
</VirtualHost>