PDA

View Full Version : apache won't serve index.php - lists directory instead


androm31
February 14th, 2009, 17:45
<em>Big Hello</em> to the list, and a big <em>Thank You!</em>
I have had a server running for over 6 months on 6.3 and have now upgraded to 6.4 entirely helped by posts on forums.freebsd.org, haven't even needed to ask a question!

Could ramble on but problem is this:

My setup:
php 5.2.8
apache 1.3.39 with Suhosin patch

.htaccess that has:
DirectoryIndex index.php index.html index.htm

When I browse to web root directory in Firefox (or any browser)
if there is index.html, it will display no problems

The problem comes when there is no index.html but an index.php instead.

I get a directory listing instead!:(

Any ideas on what I can do to .htaccess httpd.conf or php.ini to correct this?

Cheers

rghq
February 14th, 2009, 23:59
If you call "index.php" directly, does this work ?

If so, maybe try to check in httpd.conf for something like:

<Directory /the_directory/you_want_to_serve>
AllowOverride None
</Directory>

If that is maybe set and try setting "DirectyIndex" here.

gilinko
February 15th, 2009, 08:56
Have you set the mime types and is the module loaded by apache? ie:

LoadModule php5_module <some path>libphp5.so

and

application/x-httpd-php .php

Otherwise apache doesn't know that it should parse the .php files. Also if you really don't have to I would suggest moving off the 1.3 apache series to the 2.2 series.

androm31
February 15th, 2009, 11:13
I can call index.php directly.

>gilinko
I do have the LoadModule php5_module <some path>libphp5.so line

Actually the whole httpd.conf is a little untidy.

Thanks for the pointers, I'll post back what works.

androm31
February 15th, 2009, 11:44
OK, fixed that!
DirectoryIndex <Ifmodule> section wasn't set up for php5 properly.

I re-read
http://www.freebsdmadeeasy.com/tutorials/web-server/install-php-5-for-web-hosting.php

I will make time to move up to apache 2.2 though soon.

cheers