# # BindAddress: You can support virtual hosts with this option. This directive # is used to tell the server which IP address to listen to. It can either # contain "*", an IP address, or a fully qualified Internet domain name. # See also the <VirtualHost> and Listen directives. # BindAddress * 这个加了没有。
### Section 3: Virtual Hosts # # VirtualHost: If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs-2.0/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration.# # Use name-based virtual hosting. #ServerName server.company.com NameVirtualHost 192.168.0.9# # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. #The first VirtualHost section is used for requests without a known # server name. #<VirtualHost 192.168.0.9> ServerAdmin [email protected] DocumentRoot /home/test ServerName test.company.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> 这是我在httpd.conf里面设置的内容,其它的都为默认的配置
<?php
$mysqlhost="localhost";
$username="root";
$password="123";
$mysqldbname="test";
$conn = @mysql_connect($mysqlhost,$username,$password);
if(!$conn){
echo("没能连通数据库服务器" );
exit();
}
if(!@mysql_select_db($mysqldbname)){
echo( "没能连通数据库");
exit();
}
?>
# BindAddress: You can support virtual hosts with this option. This directive
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the <VirtualHost> and Listen directives.
#
BindAddress * 这个加了没有。
去掉#了没?
再看看这里的讨论
http://www.douzhe.com/docs/bbsjh/3/13871.html
BindAddress * 这个是在什么地方添加的?我在httpd.conf里面加了以后,起httpd会出错!提示:
Apache 1.3 configuration directives found
please read /usr/share/doc/httpd-2.0.40/migration.html
直接修改system32\drivers\etc\hosts文件(linux系统的话是/etc/hosts),里面加一行映射
192.168.0.9 test.company.com
就行了。
每次测试你都去改真实的dns设置不是要烦死。BindAddress的话你直接在httpd.conf里面搜索,他初始的配置应该就有的。
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.#
# Use name-based virtual hosting.
#ServerName server.company.com
NameVirtualHost 192.168.0.9#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#The first VirtualHost section is used for requests without a known
# server name.
#<VirtualHost 192.168.0.9>
ServerAdmin [email protected]
DocumentRoot /home/test
ServerName test.company.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
这是我在httpd.conf里面设置的内容,其它的都为默认的配置