0

So i've done this before but I don't remember the command. I was able to use a directory a localhost file. I've tried sudo apachectl start but when I go to localhost the page isn't found. I've also tried restarting the server, but the result was still the same. Any ideas? I'm using OSX Mavericks

1
  • What do you mean by "Can't start PHP localhost?" Do you mean that the server starts but you can't use PHP? Mar 25, 2014 at 1:24

2 Answers 2

1

I think you have a problem with opening http://localhost ?

If I'm right you should check your httpd.conf:

Look for: Listen 80 <- This line should not be commented and make sure 80 is written ( when you write localhost into your browser, the browser checks the 80 port on default. )

If it's 80 then check your if your server root folder is OK:

Must be where the --prefix folder is : normally under /usr/local/apache2.x.x

Then you should check that the DocumentRoot points to the right folder (where your index.html is located if no index.html is present)

0

Maybe the server command you use is running of a different port.

Just typing in http://localhost will only work if the port is set to 80.

Try: sudo php -S localhost:80 to run a PHP server of port 80, the downside of this is that you'll have to run it as root. It's also possible not to run this as root but to configure servers on ports lower than 1240, OS X always needs admin privilege.
The command php -S localhost:8000 will run without root but you'll have to type in http://localhost:8000 to get the webbrowser to display your server's contents.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .