Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to enable a few ports, as I have a php script that uses sockets.

I added the following to my httpd.conf file:

Listen 6112
Listen 6113

However, when I execute my php script, it says the ports are already in use. How can I go by using those ports for my script?

share|improve this question
Are you trying to listen to those ports with PHP directly? If so, then you probably shouldn't be setting Apache to listen to those ports. Please be more specific about what you are trying to do. – Zoredache Jul 11 '11 at 1:37

If you put those two Listen directives in your httpd.conf, then apache will bind those ports, making them unavailable to your php scripts.

share|improve this answer
Then how can I go by opening the ports? I've tried iptables, but I couldn't get that working. – Spencer Jul 11 '11 at 1:14
After removing those Listen lines from your apache config, what errors are you getting when attempting to bind those ports? Have you run the netstat command recommended by another answerer? – EEAA Jul 11 '11 at 1:45

The "netstat -l -p" (without the quotes) command will list out the currently active listening ports.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.