19

我使用 PHP 和 jQuery 创建了一个移动网站。它可以在我的 PC 上运行,但现在我想用我的 Android 设备对其进行测试。我怎样才能做到这一点?

如何从我的 Android 设备访问 WAMP 服务器的 IP?

我的手机和电脑连接在同一个路由器中。我应该直接连接到我的电脑还是可以通过路由器来连接?

我已经搜索过它,发现我必须更改 phpmyadmin.conf 中的权限,但它仍然不起作用。任何想法为什么它不起作用?

我的 httpd.config 有这样的东西。

<Directory />
    Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 192.168.0.104
</Directory>

192.168.0.104 是我的安卓设备的 IP。

4

1 回答 1

18

I assume you are using windows. Open the command prompt and type ipconfig and find out your local address (on your pc) it should look something like 192.168.1.13 or 192.168.0.5 where the end digit is the one that changes. It should be next to IPv4 Address.

If your WAMP does not use virtual hosts the next step is to enter that IP address on your phones browser ie http://192.168.1.13 If you have a virtual host then you will need root to edit the hosts file.

If you want to test the responsiveness / mobile design of your website you can change your user agent in chrome or other browsers to mimic a mobile.

See http://googlesystem.blogspot.co.uk/2011/12/changing-user-agent-new-google-chrome.html.

Edit: Chrome dev tools now has a mobile debug tool where you can change the size of the viewport, spoof user agents, connections (4G, 3G etc).

If you get forbidden access then see this question WAMP error: Forbidden You don't have permission to access /phpmyadmin/ on this server. Basically, change the occurrances of deny,allow to allow,deny in the httpd.conf file. You can access this by the WAMP menu.

To eliminate possible causes of the issue for now set your config file to

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    <RequireAll>
        Require all granted
    </RequireAll>
</Directory>

As thatis working for my windows PC, if you have the directory config block as well change that also to allow all.

Config file that fixed the problem:

https://gist.github.com/samvaughton/6790739

Problem was that the /www apache directory config block still had deny set as default and only allowed from localhost.

于 2013-10-02T07:58:49.910 回答