views:

407

answers:

3

I have just installed centos, apache and php when I visit my site http://domain.com/myapp/, it says "forbidden" by default its not loading the index.php file.

When I visit http://domain.com/myapp/index.php, it works fine.

Any idea how to fix that issue ?

+5  A: 

Apache needs to be configured to recognize index.php as an index file.

The simplest way to accomplish this..

  1. Create a .htaccess file in your web root.

  2. Add the line...

DirectoryIndex index.php

Here is a resource regarding the matter...
http://www.twsc.biz/twsc_hosting_htaccess.php

Edit: I'm assuming apache is configured to allow .htaccess files. If it isn't, you'll have to modify the setting in apache's configuration file (httpd.conf)

John Himmelman
It should probably be in the php.conf file that apache loads.
staticsan
I think you mean php.ini. Regardless, his apache isn't recognizing index.php as a directory index file. Whether its handling php files is another apache config issue.
John Himmelman
+2  A: 

Try creating a .htaccess file with the following

DirectoryIndex index.php

Edit: Actually, isn't there a 'php-apache' package or something that you're supposed to install with both of them?

animuson
+2  A: 

At a guess I'd say the directory index is set to index.html, or some variant, try:

DirectoryIndex index.html index.php

This will still give index.html priority over index.php (handy if you need to throw up a maintenance page)

Ben Rowe