PHP about host calls to Linux services on virtual machines

Source: Internet
Author: User
Tags mysql host
My host is the window system, need to use a Linux open source service, now is the way to install a VMWARE,VM Linux system on the host, the service installed on the VM. The problem is the PHP file on my console, how to require PHP files on the VM? And how does the PHP file on the VM call the MySQL database on the host? The process is the host PHP--Call VM Service (PHP API)--Call the host on MySQL (PHP API needs to work based on the database); Ask the master Daniel


Reply to discussion (solution)

Configure the NIC, install Apache on the VM, or you take the code directly to the VM.




And then what? is the network connection mode configured for the NIC? Bridging, Nat this?





And then what? is the network connection mode configured for the NIC? Bridging, Nat this?

I'm a bridge. You can also use a bridge to connect with this machine






And then what? is the network connection mode configured for the NIC? Bridging, Nat this?

I'm a bridge. You can also use a bridge to connect, so that the connection with the native bridge mode can be directly called? My virtual machine on Phpapi call host MySQL, I want to put MySQL host how to set?

Your virtual machine is used as a service, so it must be a static IP address (or configured with DNS)
In the same vein, you need to access MySQL on the host, and the IP without the host needs to be static.

Access the host's MySQL from the virtual machine, which is remote access.
Need to open remote access permissions for virtual machines in MySQL on the host







And then what? is the network connection mode configured for the NIC? Bridging, Nat this?

I'm a bridge. You can also use a bridge to connect, so that the connection with the native bridge mode can be directly called? My virtual machine on Phpapi call host MySQL, I want to put MySQL host how to set?

MySQL has a user table with a host field in it you change localhost to your IP or change to *, allowing non-native access








And then what? is the network connection mode configured for the NIC? Bridging, Nat this?

I'm a bridge. You can also use a bridge to connect, so that the connection with the native bridge mode can be directly called? My virtual machine on Phpapi call host MySQL, I want to put MySQL host how to set?

MySQL has a user table, there is a host field you change the localhost to your IP or change to *, so that allows non-native access to the virtual machine has a phpapi, the MySQL configuration is currently host=localhost;user=root; Pass=;p ort=3306; As you say, the MySQL table in the host is changed, but how do I recognize that localhost is pointing to MySQL on my virtual machine? I don't have a MySQL database in my virtual machine.

Your virtual machine is used as a service, so it must be a static IP address (or configured with DNS)
In the same vein, you need to access MySQL on the host, and the IP without the host needs to be static.

Access the host's MySQL from the virtual machine, which is remote access.
You need to open the virtual machine's remote access permissions on the host's MySQL virtual machine and the host should be part of the LAN communication. The MySQL configuration in my virtual machine is host=localhost, is it OK to change the host IP to Phpapi? My host IP is 192.168.0.11. The virtual machine is. 12, change the IP line directly?

Virtual machines and hosts are on a physical machine, but the communication between them is over the network
Network is not divided into size, as long as it is through the network, is remote. Not through the network is the local
Not only the IP, but also the authorization in MySQL









And then what? is the network connection mode configured for the NIC? Bridging, Nat this?

I'm a bridge. You can also use a bridge to connect, so that the connection with the native bridge mode can be directly called? My virtual machine on Phpapi call host MySQL, I want to put MySQL host how to set?

MySQL has a user table, there is a host field you change the localhost to your IP or change to *, so that allows non-native access to the virtual machine has a phpapi, the MySQL configuration is currently host=localhost;user=root; Pass=;p ort=3306; As you say, the MySQL table in the host is changed, but how do I recognize that localhost is pointing to MySQL on my virtual machine? I don't have a MySQL database in my virtual machine.
localhost directly with IP instead

Virtual machines and hosts are on a physical machine, but the communication between them is over the network
Network is not divided into size, as long as it is through the network, is remote. Not through the network is the local
Not only the IP, but also in MySQL to authorize this How to change? There is no MySQL in my virtual machine. Do I have to add the virtual machine IP I want to access in MySQL on my console?

  • 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.