XAMPP receives "Connection refused" when curling other local

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

XAMPP receives "Connection refused" when curling other local

Postby wanderingheath » 19. February 2022 00:49

Hello! I've a Reactjs app (NodeJS) running on localhost:3000 as well as a local blockchain node (Hardhat) running on localhost:8545.

There's no issues with those two communicating with each other, but I also have a XAMPP (8.1.2) server running locally on localhost:8080 with a php app that returns some values.

I can reach all these localhosts fine through the browser.

But I need the php to communicate with my blockchain node. But the connection keeps getting refused when Xampp tries to create the connection to the node.

I even tried a basic curl from Xampp's terminal, and Xampp can't reach the other localhosts at all (tried both http://localhost:port and http://127.0.0.1:port). For instance if I just wanted to curl my react app (html) from Xampp's terminal like this...

Code: Select all
curl http://localhost:3000/ -v


I get...

Code: Select all
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 3000 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* connect to 127.0.0.1 port 3000 failed: Connection refused
* Failed to connect to localhost port 3000: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 3000: Connection refused


Yes, I can curl things like google.com fine from within Xampp's terminal with no issues. It's just my localhosts. Yes, I have enabled curling in php. Yes, I can curl my react app (html) just fine from a separate terminal window. I'm on MacOS 12.1.

Thanks in advance for any help!!
wanderingheath
 
Posts: 1
Joined: 19. February 2022 00:40
XAMPP version: 8.1.2
Operating System: MacOS 12

Re: XAMPP receives "Connection refused" when curling other l

Postby Nobbie » 19. February 2022 11:06

Probably you installed the VM Version of Xampp, which runs in a Virtual Machine on your OS. That VirtualMachine has its own environment and his own universe, localhost in the VM is not the same localhost on your OS level.

Diownload and install the non-VM Version of Xampp, you can find all versions on https://www.apachefriends.org/de/download.html, the first 3 OSX versions are non-VM, the remaining 3 are VM Versions (you can see "vm" in the name of the installer and its double the size).
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 13 guests

cron