Skip to content
Advertisement

My localhost is refusing to connect on MacOS

I am running XAMPP and trying to test my PHP but cant get my localhost to connect. I have tried directing it to different ports and nothing has improved, i have tried kill httpd and stop the apache control and restarted XAMPP, still no joy. Any advice?

Advertisement

Answer

You probably installed the virtual machine version of XAMPP (e.g. xampp-osx-7.4.4.0-vm.dmg). It does not run natively on your machine, but inside a box and with its own local network IP address. It cannot be reached via localhost or 127.0.0.1 by default, because they only refer to the host system. The guest system should be seen like another machine in the LAN.

You can find the IP address of the guest system in the General tab of the XAMPP app. In my case it is 192.168.64.2. If I enter that in a browser then I get redirected to the XAMPP dashboard (Welcome to XAMPP for 7.4.4-0).

You may enable port forwarding in the Network tab of the XAMPP app. Select localhost:8080 -> 80 (Over SSH) and click the Enable button. You should then be able to reach the XAMPP dashboard via localhost:8080.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement