I created Google Cloud Virtual Machine instance with bitnami LAMP to launch PHP, MySQL and apache.
I created two files:
server.php, which is
client.php, which is
Now problem is, when client.php is trying to connect to server socket on port 8086, it took too long time and then shows error saying that : Connection Timed Out
Had almost the exact same issue, but with node.
You should allow the port in the firewall on Google Cloud and in the Virtual machine too to get this to work.
In Google Cloud you should open it like this answer: How to open a specific port such as 9090 in Google Compute Engine
If you have ubuntu in your VM, you open the port typing: sudo ufw enable // This allows firewall sudo ufw allow 8086 // This allows your port
Hope it helps.