I have Apache and PHP installed on my computer. I have an index.php file in my htdocs folder. When I call localhost I get the contents of my htdocs folder in an Index of / page. However if I type localhost/index.php the page loads OK. In my httpd.conf file DirectoryIndex is set to index php and index.html.
Can anyone see why this is happening?

Thanks,

Recommended Answers

All 6 Replies

Member Avatar for rajarajan2017
<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

This is what I have in my httpd.config. Just have a cross reference.

Cheers mate, changed the httpd.conf file but same result.

Member Avatar for rajarajan2017

Check whether XAMP control panel started the apache and mysql

I actually uninstalled XAMP and installed Apache and PHP seperately. PHP files display fine after you click on them from the list of 'Index of/' files

Member Avatar for rajarajan2017

XAMPP will install you everything you need and not much of space, then why did you removed? I think it will work again you installed XAMPP.

Old post, but for anyone else stumbling on this today (as I just did): restarting apache after updating httpd.config (as per rajarajan2017's reply above) should do the trick.

sudo apachectl restart (using Terminal on MacOS)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.