Reputation: 348
I'm configuring the PHP server and set the default address to the localhost but every time when I run localhost, it always runs another index.php. The localhost directory of MacBook is /Library/WebServer/Documents/
, and I found there is no index.php in this directory.
I run localhost on the browser and clicked inspect, it showed that the file name is index.php, is possible to find this index.php file on my computer?
Upvotes: 0
Views: 415
Reputation: 51
Have you tried creating an index.html file in that directory? Perhaps that might take priority over the other files.
$ touch /Library/WebServer/Documents/index.html
$ echo "Hello World" >> /Library/WebServer/Documents/index.html
Now go to the site, and check. If it displays hello world in plain text, then you just need to create an index.php file in that directory location, and just copy and paste your code into that file. You can also move your existing files there ...
$ mv /path/to/current/index.php /Library/WebServer/Documents/
Also after doing some research (as I am a bit unfamiliar with using Mac OS as a web server, I mostly use Linux). Turns out that Mac OS has 2 locations where it stores files to host as a web server!
You can find more info about it here!
Upvotes: 2