If you are 100% sure the php-code is not flawed (would not hurt posting it here though

), I would advice you to look at your apache.conf or http.conf (it could be at /etc/apache/ or /etc/httpd.conf... if you are not sure which file it is, try searching for it with find. Might take a while, but I'd start at etc if I was you.e.g: find /etc -name apache.conf).
Once you've found that file, search for "DirectoryIndex" and make sure to place index.php in the front of the other extensions.
Regards!