4
I'm on OSX Mavericks. I installed PHP 5.5 from http://php-osx.liip.ch/. When I go to localhost in a browser I get a page that says, "It Works!" which is not a page I created so I am not sure where it is located. Is this from the PHP install or just Apache?
When I open my IDE (PHPStorm) and run the website, it works if I use a port like 8080. If I set the port to 80, it fails and the IDE says:
/usr/local/php5/bin/php -S 0.0.0.0:80 -t /mywebsitepath/
Failed to listen on 0.0.0.0:80 (reason: Permission denied)
When I searched for that specific error, all I found was help for NGINX, but I am using Apache. What do I need to change to be able to run my code locally on port 80?
I want to do this so I can use localhost instead of localhost:8080.
3
Since you get a page from http://localhost, then means some software on your computer is already using port 80. Two programs can't use the same port at the same time.
– Ben Voigt – 2014-01-29T20:13:24.790How can I see what is currently using it? I'm guessing it's something that happens at start-up. – Justin – 2014-01-29T20:15:22.350
For that, see Who is listening on a given TCP port on Mac OS X?
– Ben Voigt – 2014-01-29T20:27:06.030When I do
sudo lsof -i TCP:80 | grep LISTEN
I get no results. – Justin – 2014-01-29T20:38:55.390you didn't turn off port number->name lookup, so it might be outputting
TCP:http
(I don't know about Maclsof
, butnetstat
on other OSes would). Check the output of justsudo lsof -i TCP
to see what format it is in. – Ben Voigt – 2014-01-29T20:46:10.767Oh yea totally forgot, you could setuid on the php binary (or wrap it in a shell script). Its insecure, but as a dev environment it might just do – Yarek T – 2014-01-29T21:04:15.407
And IIRC OSX has launchd, its a bit like inetd, the internet super server. Its a binary that listens on all ports and spawns a corresponding process whenever a specific port is hit by a request – Yarek T – 2014-01-29T21:07:30.790