# Apache 2 + php 4: Did anybody made it work?

## Tuxisuau

There's no official support for apache2 in php 4.2.2 but i've heard somewhere that is possible to install it.

Is it possible to use mod_php?

If not, or if you know, How do I install it as a cgi?

----------

## EPrime

I managed to compile Apache 2.0.39 with mod_php 4.2.1 from source (using gcc 2.95 on Mandrake). For Apache, I used:

```
./configure --prefix=/usr/local --with-port=80 --enable-static-support --with-mpm=worker --enable-modules=all --enable-so --with-z=/usr/lib --with-ssl=/usr/local/ssl/lib --enable-mods-shared="auth_anon deflate expires headers info mime_magic proxy rewrite speling ssl php perl"
```

And for mod_php I used:

```
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pear --enable-safe-mode --with-openssl --with-zlib=shared --with-bz2=shared --enable-ftp=shared --with-pgsql=/usr/local/pgsql --with-mysql=/usr/local/mysql
```

You can probably skip specifying the paths to libraries (zlib, ssl, mysql, postgres) and might want to drop some of the --with stuff depending on your setup and desires.

Note: this did not work with 2.0.40 and mod_php 4.2.2, but might with a newer cvs snapshot of the php source. Give me a few days and I can post my findings when trying on the Gentoo box (now using gcc 3.2  :Very Happy: ).

----------

## EPrime

Another thing - there's actually an ebuild for Apache2, you just need to unmask it by editing file /usr/portage/profiles/package.mask before emerge allows you to install it.

It might be masked for a good reason - such as it doesn't work or compile. Also, I have no idea how Gentoo handles having both 1.3 and 2.0 installed (since 2.0 is probably an upgrade rather than a new package), so if this is your plan installing from source into a separate location may be the best solution (mine is actually in /chroot/apache2).

----------

## dreamer3

If you want Apache2 + PHP4... unmask Apache 2 and emerge... I had to create a symlink in the files dir from 2.0.40 to 2.0.43 to get it to emerge.

I went ahead an unmasked mod_PHP 4.2.3 although 4.2.2 should work.  You will need to modify the configure section to appear like this:

```
./configure \

        ...

        --with-apxs2="/usr/lib/apache2/bin/apxs -ltiff" \

        ...
```

Note, PHP 4.2.x support for Apache 2 is still experimental though evidentally quite a few people are using it with much success.  My emerge of mod_php-4.2.3 just completed successfully.  :Smile: 

EDIT: Ok, the ebuild needs a little more tweaking (all the files get put in the wrong places for Apache 2) and the auto-config is only for Apache 1.x so you'll have to edit some config files by hand to get it working, but at least it compiles  :Smile: 

----------

