# [Solved] Silly Apache/PHP configuration problem

## spawnv

At some point while I wasn't looking, Apache quit processing PHP.  It just displays source code. I have no idea what I did to break it.

I've been through the HOWTO's over and over, checking my configuration.  Here's the details (I think I'm getting all the configuration files):

/etc/apache2/conf/apache2.conf:

LoadModule php4_module extramodules/libphp4.so

/etc/apache2/conf/commonapache2.conf:

<IfModule mod_mime.c>

    TypesConfig conf/mime.types

    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>

(So maybe mod_mime isn't loading?  How can I check that?)

/usr/liblapache2/build/config_vars.mk has

DSO_MODULES = ... mime ...

(Lots of others, I'll be happy to paste them all if anyone's interested)

/etc/apache2/conf/apache2.conf does have

LoadModule mime_module modules/mod_mime.so

Back to commonapache2.conf:

# Fix some bugs -- as directed by gentoo

<Files *.php>

        # keep this the same size as post_max_size in php.ini

        LimitRequestBody 8388608

</Files>

<Files *.phps>

        # keep this the same size as post_max_size in php.ini

        LimitRequestBody 8388608

</Files>

/etc/apache2/conf/modules.d/70_mod_php.conf -- a default version that got installed at some point

I do USE apache2 when building mod_php.

I have the latest unmasked apache (almost. apache-2.0.54-r7 vs r8.  I'm emerge'ing that now) and php (4.4.0) ebuilds.

When I use /etc/init.d/apache2 restart I get the following in my error log:

[Mon Aug 08 20:31:44 2005] [notice] Digest: generating secret for digest authentication ...

[Mon Aug 08 20:31:44 2005] [notice] Digest: done

[Mon Aug 08 20:31:45 2005] [notice] Apache/2.0.54 (Gentoo/Linux) configured -- resuming normal opera

tions

Using apache2ctl -D PHP4 -D PYTHON -k restart, I get this:

[Fri Aug 12 15:26:24 2005] [notice] Digest: generating secret for digest authentication ...

[Fri Aug 12 15:26:24 2005] [notice] Digest: done

[Fri Aug 12 15:26:25 2005] [notice] mod_python: Creating 32 session mutexes based on 150 max process

es and 0 max threads.

[Fri Aug 12 15:26:25 2005] [notice] Apache/2.0.54 (Gentoo/Linux) PHP/4.4.0 mod_python/3.1.3 Python/2

.3.4 configured -- resuming normal operations

/etc/apache2/apache2-builtin-mods has the line:

mod_mime shared

/etc/conf.d/apache2 does have the line

APACHE2_OPTS="-D PHP4 -D PYTHON"

Python and perl cgi work fine, BTW.

Does anyone have any thoughts?  Am I missing something obvious?

Thanks in advance,

JamesLast edited by spawnv on Mon Aug 15, 2005 12:41 am; edited 1 time in total

----------

## UgolinoII

I have aways found I have had to be particularly fussy end explicitly stop/start apache instead of using restart whenever i get this issue.

Does putting invalid syntax in /etc/apache2/conf/modules.d/70_mod_php.conf give you an error when restarting apache? (to confirm that it is reading this file)

----------

## spawnv

The bad syntax in 70_mod_php.conf (inside the #ifdef) does cause an error.

I'll definitely remember the tip about explicit stop/start, though that didn't fix the problem.

BTW, I thought  should mention that the emerge didn't fix the problem either.  I think I read something somewhere about someone who had to emerge mod_php after apache, so  I guess that's the next thing for me to try.

----------

## titaniumlou

I was having the same problems, but adding this line to the mime.types file fixed the problem and now all of my php stuff runs just fine.

application/x-httpd-php		php php3 phtml php4

and that should do it.

I added some strange lines into my 70_mod_php.conf but it didn't seem to be reading this file for some reason....

So I'm guessing you can either add that line above to your mime.types file or figure out why apache2 isn't reading the 70_mod_php.conf file...

If you can figure out why that file isn't getting read please PM me so I can try to get that fixed up on my system too.

Thanks!

----------

## spawnv

I *knew* it had to be something stupid.

Somewhere or other I ran across the advice to add the following line to commonapache2.conf:

AddType text/html .php

I was having this problem, but I hadn't gone through all the troubleshooting/reinstalling--this was one of the first things I tried.

I just REM'd it out, and PHP started working again.  (Heh.  I can now even start it up with /etc/init.d, instead of hacking with apache2ctl  :Very Happy:  )

titaniumlou:

I don't have any idea why 70_mod_php.conf wouldn't get read.  My apache2.conf just does a "Include conf/modules.d/*.conf."  Is it possible PHP4 isn't defined for you there?  I remember having nasty troubles figuring out where to actually define it. (It's obvious when you find the spot, since there's a comment that tells you to do it. It's just a question of digging through all those configuration files to find it).

BTW, thanks again to everyone for the advice, and even from just taking the time to read it.

----------

## titaniumlou

yeah, i found where to define the "-D PHP4" in the apache startup files, and then the 70_mod_php.conf file gets read and everything's hunk-dory

Thanks!

----------

## spawnv

art a new thread)

Titaniumiou,

Out of curiousity, is PHP running as a module now, or CGI mode?  I need it to run as a module (which it once did), but now it won't.  I think I'm starting to get gray hairs over this.

----------

