2013-06-22 58 views
1

WAMP的服务器我做了一个网页。它使用mysql。它工作正常,如果我从我的系统(本地主机)访问它。我已经上传我的网页在服务器上为我的朋友连接到它。但是我无法连接它。我已经在这里发布了关于相关主题的其他问题。我试图通过阅读评论的知识来纠正这个问题。
喜欢把WAMP服务器联机,包括这个:连接到不同的电脑

<Directory c:/wamp/www/> 
    Order Allow,Deny 
    Allow from all 
    Require all granted 
    </Directory> 

但还在原地无法托管在服务器上后,即使从我的电脑连接。我使用了一个ftp软件来传输我的文件。我的PHP代码连接到MySQL:

mysql_connect('localhost:3306', $user, $pass) or die ("Connection Failed". mysql_error()); 
+0

警告:mysql_connect()函数[function.mysql-连接]:访问被拒绝的用户 '根' @ 'localhost' 的(使用密码:NO),这是错误我收到 – ik024

+0

' your_ip_address:3306'..try这 –

+0

你是怎么设法把WAMP服务器联机?另外请记住,PHP已经不推荐使用mysql_connect。而是使用mysqli或PDO。 - – Sid

回答

0

您需要按照下面的步骤:

1.in的httpd.conf

DocumentRoot "C:/xampp/htdocs" //add your wwwroot folder path (this is Xampp example) 
<Directory /> 
Options FollowSymLinks 
AllowOverride None 
Order deny,allow 
Deny from all 
</Directory> 

2.Open的httpd-vhost.conf并添加:

##</VirtualHost> 
    <VirtualHost Name:80> 
    DocumentRoot C:/xampp/htdocs/wwwroot/ 
    <Directory "C:/xampp/htdocs/wwwroot/"> 
    Options Indexes FollowSymLinks Includes execCGI 
    AllowOverride All 
    Order Allow,Deny 
    Allow From All 
    </Directory> 
    ServerAdmin ([email protected]) 
    ServerName (IP address or FQDN) 
    </VirtualHost> 

3.最重要的一步是在windows防火墙上为所用端口添加一个异常(本例中为80)。

希望这有助于:)

+0

我在哪里可以找到httpd-vhost.conf?我可以在我的WAMP的托盘图标找到奥菱的httpd.conf – ik024

+0

试一下: C:\ WAMP \ BIN \ apache的\ apache2.2.6 \的conf \额外\的httpd-vhosts.conf –

+0

也许这[链接](HTTP:/ /www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp)可能对你有用。 –