# More apache2 and php woes... [solved]

## cradlinski

I'm running Gentoo 2005.1 for AMD64 and just upgraded apache to version 2.0.54-r31.  I also upgraded mod_php to 4.4.0-r3.  Whenever I browse to a .php page, I get a pop-up asking if I want to download the file.  I added "-D PHP4" to APACHE2_OPTS in /etc/conf.d/apache2.  Here's my /etc/apache2/modules.d/70_mod_php.conf:

```
# vim: ft=apache sw=4 ts=4

<IfDefine PHP4>

        # Load the module first

        <IfModule !sapi_apache2.c>

                LoadModule php4_module    modules/libphp4.so

        </IfModule>

        # Set it to handle the files

        <IfModule mod_mime.c>

                AddType application/x-httpd-php .php

                AddType application/x-httpd-php .phtml

                AddType application/x-httpd-php .php3

                AddType application/x-httpd-php .php4

                AddType application/x-httpd-php-source .phps

        </IfModule>

        AddDirectoryIndex index.php index.phtml

</IfDefine>
```

It looks as though the php module should get loaded. I turned the log level up to debug in httpd.conf but there's nothing of any value in there.  So, I have two questions:How can I tell if the php module has been loaded?

Why won't apache recognize .php pages?Thanks.Last edited by cradlinski on Mon Oct 24, 2005 12:31 am; edited 1 time in total

----------

## cradlinski

I figured out that the php module IS being loaded.  I tried to load it explicitly in httpd.conf and got:

```
 [warn] module php4_module is already loaded, skipping
```

So, this must be some kind of mime.types issue, right?  I added these lines to httpd.conf but it made no difference:

```
AddType application/x-httpd-php .php

AddType application/x-httpd-php .phtml

AddType application/x-httpd-php .php3

AddType application/x-httpd-php .php4

AddType application/x-httpd-php-source .phps
```

Any suggestions?

----------

## apberzerk

I have the same, or similar, problem.  mod_php appears to be loading correctly, but when I go to a php page, it just doesn't activate php.  Furthermore, it seems like other modules, such as mod_ftpd, are not working either.

This all started after upgrading mysql, and could be related to that, though I have re-emerged everything that revdep-rebuild thinks I should.

- Phil

----------

## cradlinski

Same story here.  I upgraded mysql and that broke everything.  I've revdep-rebuilt everything a couple of times.  I've unmerged and emerged to no avail.  I thought this may be an AMD64 issue but it seems as though a lot of x86 folks are having the same problems.

----------

## cradlinski

One more thing...

Command-line php works.  If I put this in a file called "test.php":

```
<html>

<body>

<?php

print "PHP Info:\n";

phpInfo();

?>

</body>

</html>
```

...and run "php -f test.php," it works fine.  I think this means PHP is OK and the problem is with apache.

----------

## apberzerk

Same here.

----------

## .abe

I agree, that was quite the upgrade. My php didn't work at first either but now it does.

From /etc/conf.d/apache2, this is what my APACHE2_OPTS looks like now:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D SSL -D PHP4"
```

I hope this helps

----------

## apberzerk

I don't have DEFAULT_VHOST, and mine looks like this:

(I use initng, so it's a bit different... the "-k start" belongs there):

```

daemon_args = "-D SSL -D PHP4 -D FTPD -k start"

```

----------

## Bushwack

I'm having the same problem, but php works properly if I access it using 127.0.0.1 instead of localhost (obviously I just run apache locally).

Edit: forget that it seems it was just a browser caching issue, everythings working fine for me.

----------

## cradlinski

 *.abe wrote:*   

> I agree, that was quite the upgrade. My php didn't work at first either but now it does.
> 
> From /etc/conf.d/apache2, this is what my APACHE2_OPTS looks like now:
> 
> ```
> ...

 

I've got all of that in mine and it makes no difference.  The PHP module doesn't work.

----------

## BastianBalthazarBux

use 

```
revdep-rebuild --library=libmysqlclient.so.12
```

instead of a plain revde-rebuild, will be documented soon

----------

## cradlinski

That didn't do it for me.  My problem right now is with PHP and Apache, not MySQL.

----------

## apberzerk

 *Quote:*   

> I'm having the same problem, but php works properly if I access it using 127.0.0.1 instead of localhost (obviously I just run apache locally). 

   This is true for me also.

I've tried running this command

```
revdep-rebuild --soname libmysqlclient.so.12
```

 (note: it's --soname, not --library.  --library was an invalid option according to revdep)

Anyway, this command fails while emerging sci-libs/root:

```

/usr/include/mysql/mysql.h:470: error: too few arguments to function `int 

   mysql_shutdown(MYSQL*, mysql_enum_shutdown_level)'

mysql/src/TMySQLServer.cxx:241: error: at this point in file

make: *** [mysql/src/TMySQLServer.o] Error 1

make: *** Waiting for unfinished jobs....

!!! ERROR: sci-libs/root-4.02.00 failed.

!!! Function src_compile, Line 169, Exitcode 2

!!! make failed

!!! If you need support, post the topmost build error, NOT this status message.

```

----------

## cradlinski

 *apberzerk wrote:*   

>  *Quote:*   I'm having the same problem, but php works properly if I access it using 127.0.0.1 instead of localhost (obviously I just run apache locally).    This is true for me also.

 

Me, too.  However, it only works if I explicitly load the page.  If I get there through a redirect, it still doesn't work.

Why?!?

----------

## cradlinski

Have we found a bug?

----------

## apberzerk

No, it must be our fault in some way, lol.  Actually, I remembered that my computer isn't localhost, it's tux.  So, really, I shouldn't be going to http://localhost anyway.

- Phil

----------

## Kloeri

Try clearing your browser caches. Many people have experienced issues where one url works and another url doesn't (localhost versus proper name for example) even though they should return the same page. In most (all?) these cases clearing the browser cache solved the issue.

----------

## nobspangle

make sure that you have added index.php to your list of Directory indexes in httpd.conf

----------

## Kloeri

 *nobspangle wrote:*   

> make sure that you have added index.php to your list of Directory indexes in httpd.conf

 

That's done automatically when you have APACHE2_OPTS="-D PHP4" in /etc/conf.d/apache2 - substitute appropriate apache and php versions as you like.

----------

## travisau

I had the same issue with mythweb.  Clearing browser cache fixed the issue.

----------

## .abe

In order to get apache2 straightened out on my box I found it easier to unmerge and re-emerge from nothing. Then make changes to the new config files. Depending on how desperate you are, try this. Also pay attention to the little notices after emerging apache2 on the commandline. If I remember correctly, I had to make some other tweaks to get my system squared away in order for it to work.

----------

## cradlinski

Clearing my browser cache fixed it, too.  Thanks for everybody's help.

----------

## apberzerk

I'm good too.  So... this thread is done  :Smile: 

----------

## Jovana

 *.abe wrote:*   

> 
> 
> From /etc/conf.d/apache2, this is what my APACHE2_OPTS looks like now:
> 
> ```
> ...

 

Great, this helps for me. Problems solved!!

----------

