Php about host calling linux services on virtual machines my host is a Windows system and a linux open source service is required. now we can install vmware on the host and linux on the vm, install the service on the vm. The problem is how to require the php file on the vm on my host? And how do I call mysql databases on the host using php files on the vm? The process is to host php --> call vm service (php api) --> call mysql on the host (php api needs to work based on the database );
Reply to discussion (solution)
Configure the NIC, install apache on the VM, or run the code directly in the VM.
What then? Is network connection mode configured for the NIC? Bridging, NAT?
What then? Is network connection mode configured for the NIC? Bridging, NAT?
I am doing Bridge. You can also use bridging to connect to the local machine.
What then? Is network connection mode configured for the NIC? Bridging, NAT?
I am doing Bridge. You can also use bridging, so that you can communicate with the local machine and use the bridging mode to directly call it? I use the php api on the virtual machine to call the host mysql. how do I set the host of mysql?
Your virtual machine is used as a service, so it must be a static ip address (or configured with DNS)
Similarly, if you need to access mysql on the host, the ip address without the host must be static.
Access the mysql instance from a virtual machine. this is remote access.
You need to enable the remote access permission of the VM in the mysql instance of the host.
What then? Is network connection mode configured for the NIC? Bridging, NAT?
I am doing Bridge. You can also use bridging, so that you can communicate with the local machine and use the bridging mode to directly call it? I use the php api on the virtual machine to call the host mysql. how do I set the host of mysql?
Mysql has a user table with a Host field. you can change Localhost to your IP address or * to allow non-local access.
What then? Is network connection mode configured for the NIC? Bridging, NAT?
I am doing Bridge. You can also use bridging, so that you can communicate with the local machine and use the bridging mode to directly call it? I use the php api on the virtual machine to call the host mysql. how do I set the host of mysql?
Mysql has a user table with a Host field. you can change Localhost to your IP address or * to allow non-local access to the phpapi in the virtual machine, the mysql configuration in the table is currently host = localhost; user = root; pass =; port = 3306; add the mysql table in the host as you said, but how can I identify that localhost points to the mysql of the host in my virtual machine? I have no mysql database in my VM
Your virtual machine is used as a service, so it must be a static ip address (or configured with DNS)
Similarly, if you need to access mysql on the host, the ip address without the host must be static.
Access the mysql instance from a virtual machine. this is remote access.
You need to enable the remote access permission of the VM in the mysql instance of the host. the VM and the host should belong to the communication between the LAN. In my virtual machine, the mysql configuration in php api is host = localhost; can I change this host to the host ip address? My host ip address is 192.168.0.11. The virtual machine is. 12. can I directly change the ip address line?
Although virtual machines and hosts are on a physical machine, the communication between them goes through the network.
The network is remote as long as it passes through the network. The local device does not pass through the network.
Not only this ip address, but also authorization in mysql
What then? Is network connection mode configured for the NIC? Bridging, NAT?
I am doing Bridge. You can also use bridging, so that you can communicate with the local machine and use the bridging mode to directly call it? I use the php api on the virtual machine to call the host mysql. how do I set the host of mysql?
Mysql has a user table with a Host field. you can change Localhost to your IP address or * to allow non-local access to the phpapi in the virtual machine, the mysql configuration in the table is currently host = localhost; user = root; pass =; port = 3306; add the mysql table in the host as you said, but how can I identify that localhost points to the mysql of the host in my virtual machine? I have no mysql database in my VM
Localhost is directly replaced by IP address
Although virtual machines and hosts are on a physical machine, the communication between them goes through the network.
The network is remote as long as it passes through the network. The local device does not pass through the network.
Not only the ip address, but how should I change the authorization policy in mysql? I don't have mysql in my VM. Do I need to add the ip address of the virtual machine to be accessed in mysql on the host?