I recently purchased a new MacBook Pro (10.8 OS) and installed MAMP 3.0 (not MAMP-Pro) but I have been searching the web on how to display all files when viewing a folder within the htdocs
directory such as: htdocs/stackoverflow
VIA the browser (Chrome or Firefox). This is a feature that I do not have a problem with in Windows using either WAMP or XAMPP when navigating to the localhost/directory/contents
. I do understand that localhost
must be accessed through locahost:8888
or whatever port it has been modified to. I do not have an issue starting or stopping the MAMP server and everything is executable through NetBeans 8.0 when I set a .php
file as the index:
So just to be clear, if I have a directory under htdocs (htdocs/foobar/
) filled with several .php
files I want to be able to view them in the sub-directory of htdocs instead of a blank browser (tested within Chrome and Firefox). I would imagine this is a security setting I am missing in the configuration? How would I enable, for local development, the ability to view all files, directories, and contents VIA the web browser? If it helps or may be an issue I am using NetBeans 8.0 as my IDE for PHP.
localhost
-stackoverflow
--foo.php
--bar.php
--humpday.php
localhost:8888
-stackoverflow
--empty in browser (chrome or Firefox)
I have searched to see if this a php.ini
feature, MAMP 3 documentation has nothing on this, and Netbeans shows nothing per the search.
Ok after much research and the help from Kevbot and Matt Thompson I was able to figure out what to do and it is as followed:
You should enable all hidden files in Mac that are default hidden. To do this open a terminal (Finder > Applications > Utilities > Terminal
) I originally referenced this site but it was wrong in regards to showing hidden files for OSX 10.8:
defaults write com.apple.Finder AppleShowAllFiles YES
defaults write com.apple.finder AppleShowAllFiles YES
After doing so I held down the option + clicking Finder
at the same time to prompt Relaunch of Finder
.
You will need to navigate to MAMP (in this case MAMP 3.0 non-pro) in the Applications folder to MAMP > conf > apache > httpd.conf
.
Open file in a text editor and search for Options Indexes
. It was line 202 for me.
Change:
<Directory />
Options Indexes FollowSymLinks
AllowOveride None
</Directory>
TO:
<Directory />
Options Indexes FollowSymLinks
AllowOveride All
</Directory>
Create an .htaccess
file in the desired directory and add:
Options +Indexes
IndexOptions +FancyIndexing
Launch/relaunch MAMP. Do note that if you have an index anything (.php
, .html
. .xhtml
, etc. etc.) will show this instead of the directory listing