Index.php not loading automatically

Hello members,
I have installed the Apache Server and PHP on my laptop. I am able to view webpages with a .php extension, so I can safely assume that PHP has been set up correctly, however, my index pages index.php do not automatically load. Whenever I browse through the localhost to one of my “local” websites, it just shows me a list of files in the root, and I have to manually click the “index.php”. Is there something that I am missing here?
I would appreciate the assistance.
Thanks

Assuming it is Apache 2.0, you might want to make sure you have a cgi handler for .php as well as make sure the index names are connected…

in httpd.conf, look for these lines. if they don’t exist; add them:


LoadModule php5_module /usr/lib/apache2/mod_php5.so
AddType application/x-httpd-php .php

If your php files are loading normally, just that it’s not getting the ‘index’ thingie, look for this line;


DirectoryIndex index.php index.asp index.htm index.html

And make sure it has a index.php there.

Alternatively, if you can’t access your httpd.conf (which you probably can since you’re running it locally… but still) you can add this information in a .htaccess file in the wwwroot.

Oh, almost forgot… You might want to disable directory listing as well (Not that any security problems exists locally, but it’s a good habit to learn.


<Directory />
Options -Indexes
</Directory>