Local test PHP connection remote server problems this new person uses the wamp package to build a local test environment. Later, I bought a VM to store my website. I want to know how to test PHP $ conn @ mysql_connect (& quot; remote server name & quot;, & quot; database name & quot;, & quot; password & quot ;) ordie (& quot; failed to connect to the server & quot;); connection failed. However, in the virtual space to connect to the local test PHP connection to the remote server
This is a local test environment built with the wamp package. Later, I bought a VM to store my website.
I want to know how to test PHP locally
$ Conn = @ mysql_connect ("remote server name", "database name", "password") or die ("failed to connect to server ");
Connection failed.
But the connection is successful in the virtual space.
Cannot I use an external computer to execute PHP to connect to a remote server?
How can this problem be solved?
------ Solution --------------------
Why do I block errors locally?
$ Link = mysql_connect ("localhost", "mysql_user", "mysql_password ")
Or die ("cocould not connect:". mysql_error ());
View what is displayed
Whether to allow remote connection. ask your service provider.
------ Solution --------------------
Whether to write the first parameter to the host. Whether you have the remote connection permission.
------ Solution --------------------
You must have the administrator privilege to enable the remote service. you can do some exercises on your local server.
When you contact the supplier administrator and agree to allow remote connection, you must at least provide him with the following information:
Username, password, and static public network address
Make sure that Port 3306 is allowed from your machine to the supplier's mysql.