Im trying to access my localhost website on my phone. My host files are set up like so:
我试图通过手机访问我的localhost网站。我的主机文件设置如下:
httpd-vhosts:
的httpd的虚拟主机:
<VirtualHost *:80>
DocumentRoot "C:\path"
ServerName 192.xxx.x.xx
</VirtualHost>
etc/hosts:
etc / hosts文件:
192.xxx.x.xx C:\path
The ip above is the one obtained using ipconfig
上面的ip是使用ipconfig获得的ip
When I try to access the ip with my phone or laptop, I get MYSQL error
当我尝试使用手机或笔记本电脑访问ip时,我收到MYSQL错误
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045]
Access denied for user 'username'@'localhost' (using password: YES)' in C:path/DatabaseDriverMysql.php
I also tried setting up xip.io path like this:
我也试过像这样设置xip.io路径:
<VirtualHost *:80>
DocumentRoot "C:\path"
ServerName mysite.195.xxx.x.xx.xip.io
</VirtualHost>
But accessing it on my phone or laptop produces same error.
但是在手机或笔记本电脑*问它会产生同样的错误。
PS: I'm using WAMP server.
PS:我正在使用WAMP服务器。
1 个解决方案
#1
0
The virtual host definition is hardly complete but this is definitely wrong
虚拟主机定义很难完成,但这绝对是错误的
<VirtualHost *:80>
DocumentRoot "C:\path"
ServerName 192.xxx.x.xx
</VirtualHost>
Change it to
将其更改为
<VirtualHost *:80>
DocumentRoot "C:/path" <-- changed line
ServerName 192.xxx.x.xx
</VirtualHost>
#1
0
The virtual host definition is hardly complete but this is definitely wrong
虚拟主机定义很难完成,但这绝对是错误的
<VirtualHost *:80>
DocumentRoot "C:\path"
ServerName 192.xxx.x.xx
</VirtualHost>
Change it to
将其更改为
<VirtualHost *:80>
DocumentRoot "C:/path" <-- changed line
ServerName 192.xxx.x.xx
</VirtualHost>