Questions about local PHP connection to remote server

Source: Internet
Author: User
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 [email & #160; protected] _ connect (& quot; remote server name & quot;, & quot; database name & quot;, & quot; password & quot;) ordie (& quot; failed to connect to the server & quot;); connection failed. Local test PHP remote server connection problems
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
[Email protected] _ 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.