7

My Apache web server suddenly stopped serving index.php files automatically. It shows direcotry listing instead. I've tried helps but no luck.

My htttpd.conf file includes

<IfModule module_php5>
    AddType application/x-httpd-php .php
</IfMOdule>

and

DirectoryIndex index.php index.html

What could be wrong if all above are OK?

Charles
  • 48,924
  • 13
  • 96
  • 136
mavili
  • 3,185
  • 4
  • 27
  • 43
  • Note that tags stand alone. That is, combining `directory` and `index` doesn't mean the same thing as `directoryindex`. Please pick tags with care. – Charles Dec 16 '12 at 03:38
  • 1
    What if you request `index.php` explicitly? – zerkms Dec 16 '12 at 03:42
  • @Charles, I specifically wanted to tag directory and index separately. but thanks for editing the codes. – mavili Dec 16 '12 at 03:44
  • @zerkms the browser shows index.php when typed explicitly. – mavili Dec 16 '12 at 03:45
  • I am new to this site. I've read threads before, but didn't have an account until recently. So I don't know any common practice in asking questions, but will learn by time. Can I ask why you deleted "thanks in advance" from the end of my question, @Charles ? – mavili Dec 16 '12 at 04:02
  • @mavili, thanks for asking about that! We have an entire site dedicated to discussions about SO -- click the "meta" link in the header. You'll want to [read this question](http://meta.stackexchange.com/q/2950/135887) to understand why greetings and thanks are frequently removed. There's a [whole separate FAQ on meta](http://meta.stackexchange.com/questions/tagged/faq) in fact. Also, SO is *not* a forum, it is place to ask questions and get answers. Treating it like a forum is a bad idea. – Charles Dec 16 '12 at 04:09
  • In regards to your problem, did you modify `DirectoryIndex`? If so, did you restart Apache after changing the configuration? – Charles Dec 16 '12 at 04:09
  • @Charles I modified `DirectoryIndex` and restarted apache. It didn't change anything. – mavili Dec 16 '12 at 04:28

1 Answers1

7

I was surprised by the quick response when I first asked the question, and then the replies stopped! So I found the answer myself (by accident!). The main server root displayed index files fine, it was my user Sites folder that did not.

There is a .conf file for each user in apache users directory. I added

<Directory "/Users/mavili/Sites/">
    Options Indexes MultiViews FollowSymLinks SymLinksIfOwnerMatch Includes ExecCGI
    DirectoryIndex index.php index.html index.pl index.cgi
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

into the file for my username and tata, it worked!

mavili
  • 3,185
  • 4
  • 27
  • 43