# mod_php no longer loads after apache update [solved]

## andrewd18

I updated apache2 today, and found a few new things. Pretty sure my issue relates to the change from apache2.conf to httpd.conf

1) Everything's been moved from apache2.conf to httpd.conf. Good, but I'm not sure what's been moved where...

2) mod_php no longer loads (see below)

3) I cannot re-compile mod_php, since the stable version of that conflicts with the stable version of apache2. I WAS able to update just "php" to 4.4.0-r1, but it didn't fix anything.

I'll post whatever output you guys need... I do have "-D PHP4" in all the appropriate places and have restarted apache, but whenever I visit a PHP file, Firefox wants to download it, not show it, so mod_php isn't loading.

php 4.4.0-r1

mod_php 4.4.0

apache2 2.0.54-r31

All running on hardened gentoo, x86.

~~ Andrew D.

----------

## 102039

Hello,

everything purely apache related has been moved to httpd.conf, you are right about that part. But extensions like mod_php are in /etc/apache2/modules.d. There is a pretty good chance that the mod_php config file has not been installed there, but still resides in /etc/apache2/conf/modules.d. Copy it over manually if you still have it and you should be just fine. The -D PHP4 needs not to be inserted at all appropriate places, but just in /etc/conf.d/apache2.

If you don't have the the mod_php config file in /etc/apache2/conf/modules.d/, just unmerge and reemerge mod_php completly. Afaik only necessary config files will be emerged during a version update, so that might be the reason why it is not in the new location already.

----------

## llongi

For mod_php to work with the new Apache releases, you need to use the unstable (4.4.0-r3) mod_php package, since it's the only one compatible with the new Apache config layout, but it's not unstable as in "does not work", it's the same as the stable mod_php package, just with changed configuration paths.

Best regards, CHTEKK.

----------

## andrewd18

 *CHTEKK wrote:*   

> For mod_php to work with the new Apache releases, you need to use the unstable (4.4.0-r3) mod_php package, since it's the only one compatible with the new Apache config layout, but it's not unstable as in "does not work", it's the same as the stable mod_php package, just with changed configuration paths.
> 
> Best regards, CHTEKK.

 

I'm familiar with the "not unstable as in does not work" idea - I'm running AMD64 on my production box. ^_^

I've got 4.4.0-r3 emerging now... thank you in advance.

~~ Andrew D.

----------

## llongi

 *andrewd18 wrote:*   

> I'm familiar with the "not unstable as in does not work" idea - I'm running AMD64 on my production box. ^_^
> 
> I've got 4.4.0-r3 emerging now... thank you in advance.

 

Good, no problem.  :Smile:  Btw we just did stabilize mod_php-4.4.0-r3 on x86, other arches will soon follow when the arch-teams have time to check it out.

Best regards, CHTEKK.

----------

## andrewd18

Well, I emerged mod_php... but it's still not loading... FF still tries to download the php file.

*edit* Gonna play around in the config files for a while...

~~ Andrew D.

----------

## andrewd18

Yeah, it's still not loading.... any ideas? What needs to go where in order for the mod_php module to be loaded? What file do I check to make sure it is being loaded at all?

~~ Andrew D.

----------

## gcrew

The upgrading guide says:

 *Quote:*   

> check the module's .conf for IfDefine and add the name to /etc/conf.d/apache{|2} to enable it.

 

What the heck does this mean?

I tried adding:

```
APACHE2_OPTS="-D PHP4"
```

to my httpd.conf, but then I get the following:

```
 * Apache2 has detected a syntax error in your configuration files:

Syntax error on line 1097 of /etc/apache2/httpd.conf:

Invalid command 'APACHE2_OPTS="-D', perhaps mis-spelled or defined by a module not included in the server configuration

```

I tried adding:

```
Define PHP4
```

to my httpd.conf, but then I get the following:

```
 * Apache2 has detected a syntax error in your configuration files:

Syntax error on line 1096 of /etc/apache2/httpd.conf:

Invalid command 'Define', perhaps mis-spelled or defined by a module not included in the server configuration

```

I'm a little frustrated by the lack of an example here.  Any quick help would be greatly appreciated.

----------

## zomps

 *Quote:*   

> 
> 
> emerge =dev-php/mod_php-4.4.0-r3
> 
> ebuild /usr/portage/dev-php/mod_php/mod_php-4.4-0-r3.ebuild config

 

and add APACHE2_OPTS="-D PHP4" to /etc/conf.d/apache.conf

 should help

but i have similar problem with virtual hosts

when i use http://vhost.host.com/ then downloads php file

and with http://vhost.host.com/index.php shows page

Edit: these are example urls, not real onesLast edited by zomps on Mon Sep 19, 2005 8:18 pm; edited 2 times in total

----------

## dtremblay

You're supposed to put that option in /etc/conf.d/apache2

Mine says 

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

----------

## andrewd18

 *dtremblay wrote:*   

> You're supposed to put that option in /etc/conf.d/apache2
> 
> Mine says 
> 
> ```
> ...

 

Other than the -D DOC one, that's exactly how my line reads. And it still wants to download the file.

http://nextgen.no-ip.org  --- the base index.html file works, but going to my personal page (/home/andrew/public_html/personal/welcome.php) doesn't work at all, at least in the browser sense.

~~ Andrew D.

----------

## gcrew

Wow.  I can't read.  Must be the stress of PHP not working.

I added that, but it still doesn't work.

I have the following versions of everything installed:

mod_php-4.4.0-r3

php-4.4.0-r1

apache-2.0.54-r31

I added the -D PHP4 in the conf.d/apache2 file now.

Any other ideas?

----------

## gcrew

I'm sorry.  It is working.  My browser was using the broken page from its cache.  Thanks for the help.

----------

## andrewd18

Doing a shift-click (force cache bypass) doesn't fix mine. Suggestions?

~~ Andrew D.

----------

## DiStefano

 *zomps wrote:*   

> 
> 
> but i have similar problem with virtual hosts
> 
> when i use http://vhost.host.com/ then downloads php file
> ...

 

Very funny mine problem is nearly the same:

http://domain.tld  shows the page

http://domain.tld/index.php downloads the php file

Is there any solution?

Edit: Solved. Seems to be a proxy-problem.Last edited by DiStefano on Tue Sep 20, 2005 10:20 am; edited 1 time in total

----------

## llongi

 *andrewd18 wrote:*   

> Doing a shift-click (force cache bypass) doesn't fix mine. Suggestions?
> 
> ~~ Andrew D.

 

Andrew... Uhmm I just visited your page, the welcome.php works perfectly, displaying a site with the Born To Frag Linux image in the middle.

So it's your cache, many people experienced problems with this... Make sure you do not have caching proxies between yourself and the server, delete the cache of your browser completely, and restart said browser. That should fix it.

Best regards, CHTEKK.

----------

## andrewd18

LOL. Okay, so it's just me now. Tried it with a different browser... you're right. TY!

----------

## Romses

Hmm I also got some problems with apache2/mod_php

http://127.0.0.1/index.php did not work (try to download)

http://localhost/index.php works.

strange, strange, strange....

Romses

----------

## GreenDragon

I have problem whith compilling mod_php-4.4.0-r3:

```

checking for fopencookie... yes

configure: error: can not run test program while cross compiling

!!! Please attach the config.log to your bug report:

!!! /var/tmp/portage/mod_php-4.4.0-r3/work/php-4.4.0/config.log

!!! ERROR: dev-php/mod_php-4.4.0-r3 failed.

!!! Function econf, Line 496, Exitcode 0

!!! econf failed

```

My system:

1) gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7. :Cool: 

2) apache-2.0.54-r31

What can I do? Thank's!!!

----------

## llongi

Hi, I've had a similar problem some time ago.

Please post the content of /etc/make.conf, so I may see if the problem is there.

Best regards, CHTEKK.

----------

## GreenDragon

 *CHTEKK wrote:*   

> Hi, I've had a similar problem some time ago.
> 
> Please post the content of /etc/make.conf, so I may see if the problem is there.
> 
> Best regards, CHTEKK.

 

Hi, CHTEKK, it's my /etc/make.conf:

```

USE="x86 -arts alsa 3dnow aalib apache2 crypt dvd encode flash fbcon -java jpeg -kde -gnome libg++ libwww mikmod mbox mmx mpeg ncurses nls nptl oggvorbis opengl pam pnp perl pdflib png python sasl samba sdl slang spell ssl svga sock5 -qtmt tiff tcpd truetype quicktime readline X xml2 xmms xv zlib"

CHOST="i686-pc-linux-gnu"

CFLAGS="-march=pentium2 -O3 -pipe"

CXXFLAGS="${CFLAGS}"

ACCEPT_KEYWORDS="~x86"

DISTDIR= /mnt/disk2/gentoo/distfiles/

GENTOO_MIRRORS="http://gentoo.osuosl.org http://ftp.gentoo.skynet.be/pub/gentoo/ ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

RSYNC_RETRIES="3"

RSYNC_TIMEOUT=180

FEATURES="fixpackages"

```

and 

```
# emerge --info

Portage 2.0.52-r1 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r1, 2.6.13-gentoo-r2-yumi i686)

=================================================================

System uname: 2.6.13-gentoo-r2-yumi i686 Pentium II (Deschutes)

Gentoo Base System version 1.12.0_pre8

dev-lang/python:     2.3.5, 2.4.1-r1

sys-apps/sandbox:    1.2.13

sys-devel/autoconf:  2.13, 2.59-r7

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6

sys-devel/binutils:  2.16.1

sys-devel/libtool:   1.5.20

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86 ~x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=pentium2 -O3 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-march=pentium2 -O3 -pipe"

DISTDIR="/mnt/disk2/gentoo/distfiles/"

FEATURES="autoconfig distlocks fixpackages sandbox sfperms strict"

GENTOO_MIRRORS="http://gentoo.osuosl.org http://ftp.gentoo.skynet.be/pub/gentoo/ ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"

LANG="ru_RU.KOI8-R"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="3dnow X aalib alsa apache2 apm avi berkdb bitmap-fonts crypt cups curl dvd eds emboss encode fam fbcon flash foomaticdb fortran gd gdbm gif gpm gstreamer gtk gtk2 imagemagick imlib ipv6 jpeg ldap libg++ libwww mad mbox mikmod mmx motif mp3 mpeg mysql ncurses nls nptl ogg oggvorbis opengl oss pam pdflib perl png pnp python qt quicktime readline samba sasl sdl slang sock5 spell ssl svga tcpd tiff truetype truetype-fonts type1-fonts vorbis x86 xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY 

```

Thank's!

----------

## llongi

Hmm ok then this is not the same problem I had.  :Smile:  Mine was a -mtune=i686 that conflicted with the -march=pentium3, or at least that's what fixed it for me (deleting the mtune I added for tests).

-O3 may be a possibility, try with -O2, but that should not make much difference.

Can you take a look at the config.log that gets created when attempting to emerge the package? This normally is in /var/tmp/portage/<package>/work/<package>/config.log after a failed attempt at emerging a package.

Try to post only relevant parts of it, like where the word "error" pops up, since normally those files are really long.  :Smile: 

Best regards, CHTEKK.

----------

