本地测试PHP连接远程服务器有关问题

WBOY
Release: 2016-06-13 13:20:13
Original
883 people have browsed it

本地测试PHP连接远程服务器问题
本新人用的wamp包建的本地测试环境。后来买了虚拟主机放自己网站。
我想知道通过本地测试PHP
$conn=@mysql_connect("远程服务器名","数据库名","密码")or die ("连接服务器失败");
连接失败。
但是放在虚拟空间连接成功。
是不能用外部电脑执行PHP连接远程服务器吗?
求各位高手解决

------解决方案--------------------
本地为什么要屏蔽错误呢?
$link = mysql_connect("localhost", "mysql_user", "mysql_password")
or die("Could not connect: " . mysql_error());
看下显示什么

是否允许远程链接 问下你的服务商不就知道了
------解决方案--------------------
第一个参数host是否写对。是否有远程连接权限。
------解决方案--------------------
开启远程服务需要有管理员权限,你可以在你自己的本地服务器上做一下练习

当你联系供应商的管理员并同意让你远程连接时,你至少需要向他提供:
用户名、口令、静态的公网地址
并确认自你的机器起直至供应商的mysql,3306端口都是被允许的

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!