Accessing Base index.html file through localhost (using php)

  Kiến thức lập trình

I’m trying to run some files through localhost using php. I’ve been running into some problems with running it, so I wanted to make sure I could run the base index.html file installed on the computer and then link my localhost to the appropriate directory.

I first found my Document Root in httpd.conf in /private/etc/apache2, which was “/Library/WebServer/Documents”.

Then, I checked that folder, where I found a file (index.html.en) with the following code:

<html><body><h1>It works!</h1></body></html>

However, when trying to access it through terminal with the following command, I got the following error after lookign up http://localhost:8080/index.html:

(base) Max@macbook-pro-6 ~ % php -S localhost:8080

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

The same result also occured with the following command, accessing through the Documents folder:

(base) Max@macbook-pro-6 Documents % php -S localhost:8080

How would I resolve this error, and then how would I change the root to point from /Library/WebServer/Documents to my desired php project?