# Wierd Apache Problem!!!

## niXers

I just updated apache on my test server from 2.0.52 to 2.0.53. Lets not mention the configuration files which were changed back to normal. I think its going to take me another good couple of hours to get used to again. Here is the problem:

Apache will no longer accept index.php. It will only accept index.html as the index file. 

To answer a couple of possible questions and for making it easier to answer my question:

1. Yes php works just fine. I have also tried the usual <?php phpinfo() ?> test and it works. All of my php files also work. 

2. Yes I did re-emerge mod_php and php.

3. I am using Vhosts, and I setup and tested them with the new configuration settings. They work!

So to sum up. The folders which are being hosted on the server with Vhost configuration wont serve index.php files. The moment I click on the file, the browser wants me to download the file. It won't even show the content of the file.

Any help would be appreciated.Last edited by niXers on Tue Mar 15, 2005 8:33 pm; edited 1 time in total

----------

## TheRAt

What version of PHP?

Check this out at the Gentoo Bugzilla.

To solve this for me, I added the following the following:

/etc/portage/package.unmask

```
dev-php/php

dev-php/mod_php
```

/etc/portage/package.keywords

```
dev-php/php ~x86

dev-php/mod_php ~x86
```

I run ~x86.

----------

## niXers

I am running PHP 4.3.10.

And could you explain how adding those lines into those places would fix this problem? no offence but this is a semi-testing server and I dont want to mess it up in a way that I would have to re-install.

----------

## TheRAt

Sorry..

My problem was from PHP 5. and it was identical to yours...

Those changes just enabled some of the masked versions of mod_php for me. If you see the results from eix below, you can see that versions of PHP5 are masked.. and I wanted to install the new PHP..

with the entries

```
eix mod_php

Search results: 1

* dev-php/mod_php 

     Available versions:  4.3.8 ~4.3.9_rc1 4.3.9 4.3.10 ~4.3.10-r1 *5.0.0 ~5.0.0-r1 ~5.0.1 ~5.0.2 ~5.0.2-r1 ~5.0.3 ~5.0.3-r1 ~5.0.3-r2 

     Installed:           5.0.3-r1 

     Homepage:            http://www.php.net/

     Description:         Apache module for PHP 5
```

without the entries

```
eix mod_php

Search results: 1

* dev-php/mod_php 

     Available versions:  4.3.8 ~4.3.9_rc1 4.3.9 4.3.10 ~4.3.10-r1 [M]5.0.0 [M]5.0.0-r1 [M]5.0.1 [M]5.0.2 [M]5.0.2-r1 [M]5.0.3 [M]5.0.3-r1 [M]5.0.3-r2 

     Installed:           5.0.3-r1 

     Homepage:            http://www.php.net/

     Description:         Apache module for PHP 5
```

Also seems that ~4.3.10-r1 is available for mod_php.. You might want to try upgrading to that version to see if it solves this problem for you...

----------

## niXers

So its not a configuration issue? cause I very much think that it is. Anytime I update something in Gentoo, the problems come from the new set of configuration files.  :Confused: 

----------

## TheRAt

It is a configuration issue, but I think with the ebuild, rather than local config files... "mod_php needs to be updated to work with apache-modules.eclass"

Unless you have a completely different problem...  :Wink: 

I should have asked you to check, but what happens when you go to http://your-website/index.php

----------

## niXers

Actually I did answer that question on the first post. When I browse the index.php, the browser prompts me to download the file. :Confused: 

----------

## pdr

If you are trying to use index.php as the directory listing, my /etc/apache2/conf/commonapache2.conf has:

```
<IfModule mod_dir.c>

    DirectoryIndex index.html index.php index.php3 index.htm

</IfModule>
```

which is what enables index.php to be served when the directory is requested (this is default code for the conf file).

Note that it requires that mod_dir be loaded.

Also: instead of etc-update (and letting it just replace all etc files), you might want to use dispatch-conf instead. It saves backups (haven't used them yet tho), and automatically displays the diff (instead of manual in etc-update). Also dispatch-conf gives you the option of merging changes - very nice if you like the CVS headers in your files to be up-to-date...

----------

## TheRAt

Is your problem fixed?

If not, have you tried ~4.3.10-r1?

----------

## niXers

 *pdr wrote:*   

> If you are trying to use index.php as the directory listing, my /etc/apache2/conf/commonapache2.conf has:
> 
> Code:
> 
> <IfModule mod_dir.c>
> ...

 

Well for one thing, I am using apache 2.0.53, so the configuration files dont exist in the same place anymore. /etc/apache2/conf/commonapache2.conf does not exist anymore.

 *TheRAt wrote:*   

> Is your problem fixed?
> 
> If not, have you tried ~4.3.10-r1?

 

That is the current version which I am using. nope still not fixed.  :Confused: 

----------

## niXers

I just solved my problem with the following method:

With the new apache version 2.0.53, the developers again forgot to add a couple of minor and un-noticable lines to the configuration file.

These are the steps I took to solve this problem:

nano /etc/apache2/httpd.conf

```
#

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the

# same purpose, but it is much slower.

#

DirectoryIndex index.html index.html.var index.php

```

And for some wierd and hard to understand reason I just had to add the index.php to the list of the files which were going to be served.

I think its safe to say that I solved this, but please!!! if you have the same problem and this doesn't fix it for you, let us know, cause in that case this calls for a Bug Report.

----------

## jaghetertoffe

I have the same error.

Running apache 2.0.53 with mod_php 5.0.3-r1.

PHP scripts work, but firefox tries to download index.php.

I have 

```
DirectoryIndex index.html index.html.var index.php
```

in /etc/apache2/httpd.conf.

Firefox says:

```

You have chosen to open 

which is a PHTML file

from http://localhost
```

I don't know how relevant it is, but it seems as if Firefox doesn't know that the name of the file is index.php

Thanks for any help,

toffe

----------

## jaghetertoffe

Never mind, it works as it should.

-toffe

----------

## niXers

So does that mean you got it fixed?

----------

## jaghetertoffe

Yes, I fixed it.

I edited some config files, and did

```
apache2ctl restart
```

and it still didn't work. So I concluded that my editing wasn't enough.

But then I rebooted and it worked!

-toffe

----------

