Skip to content
Advertisement

netcat “Connection refused” on localhost

I’m trying to get a value from a netcat connection started at a php file, but it dies with:

JavaScript

I don’t know why but it works well if I ssh it as apache user (www-data), this is what I’ve done:

1) Start an endless loop serving a date with a little delay:

JavaScript

2) Check if is working:

JavaScript

3) Create /var/www/test.php as follows:

JavaScript

4) Run it on a browser:

JavaScript

5) Finally take a look at both txt’s, dates is empty (nothing like the response in #2) and errors has the “Connection refused” error.

The server is a LAMP cluster running Ubuntu Server 9.04 with DRBD and Heartbeat.

What is driving me crazy is that this test.php works well in my laptop (LAMP on Ubuntu Desktop 9.04) and the server seems to have the ports already open and listening:

JavaScript

I think that this is a programming related question right?, if not just close it without any comments please.

Thank in advanced!!!

Advertisement

Answer

Well, it was a permission problem after all… fixed editing /etc/sudoers with visudo to add:

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