Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

annihilat1on's avatar

Localhost Server Inaccessible - Help

I've installed MAMP and have always started the localhost:8888 using Chrome and it works fine.

This time, I tried using the terminal and typed in the following and I can't seem to access http://localhost:8887 on Chrome.

This is the terminal output:

whatever-MBP:~ user$ php -S localhost:8887
PHP 7.1.1 Development Server started at Tue May  2 21:27:06 2017
Listening on http://localhost:8887
Document root is /Users/user
Press Ctrl-C to quit.
[Tue May  2 21:28:10 2017] ::1:57884 [404]: / - No such file or directory
[Tue May  2 21:28:30 2017] ::1:57885 Invalid request (Unexpected EOF)
[Tue May  2 21:28:30 2017] ::1:57886 Invalid request (Unexpected EOF)
[Tue May  2 21:30:05 2017] ::1:58164 [404]: / - No such file or directory
[Tue May  2 21:30:19 2017] ::1:58165 Invalid request (Unexpected EOF)
[Tue May  2 21:30:19 2017] ::1:58166 Invalid request (Unexpected EOF)
[Tue May  2 21:31:46 2017] ::1:58390 [404]: / - No such file or directory

Here is what Chrome says whenever I try to access http://localhost:8887

Not Found
The requested resource / was not found on this server.

I'm not sure what the issue is, could somebody help?

0 likes
5 replies
tisuchi's avatar

If you access your local mamp file by localhost:8888, you need to access your laravel also http://localhost:8888 instead of 8887, isn't that?

annihilat1on's avatar

I'm facing the same issue whether I use port 8888 or 8887. I don't have to start up MAMP to enable access to localhost:8888 or localhost:8887 via Chrome right?

Cronix's avatar

Is Users/user the actual document root (public dir of laravel)?

1 like
annihilat1on's avatar

I hid the username of mine and replaced it by "user". I couldn't see the files because the document root was not under htdocs where most of my files are saved.

How do I change the document root to default to the htdocs directory under MAMP instead of /User/<my-username>?

Snapey's avatar

I'm confused, you talk of mamp but then you start the PHP built-in server ?

Which do you want to use MAMP (apache) or PHP Server ?

If you want to use php -S localhost:8887 then cd into the folder you want to serve (htdocs) before running the php command

Please or to participate in this conversation.