# apache 2 and php

## burzmali

i installed apache2 from source manually and now i am trying to emerge php ontop of it.   however, php ./config seems to want to run apxs -ltiff and that doesn't seem to be valid.  apxs exists and is in my path.  here is the output data:

```
Sorry, I was not able to successfully run APXS.  Possible reasons:

1.  Perl is not installed;

2.  Apache was not compiled with DSO support (--enable-module=so);

3.  'apxs' is not in your path.  Try to use --with-apxs=/path/to/apxs

The output of /usr/sbin/apxs -ltiff follows

Usage: apxs -g [-S <var>=<val>] -n <modname>

       apxs -q [-S <var>=<val>] <query> ...

       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]

               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]

               [-Wl,<flags>] <files> ...

       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...

       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...

configure: error: Aborting

```

any ideas on how to get around this?  thanks in advance for any help.

----------

## roman

Without big patching of ebuild files you have no chance, 'cause

php has another apxs options for apache 2. You will need

to unpack the php source and run ./configure --help for answer.

After you will know, what parameters you will need, patch the 

ebuild file according to your wanted configuration...

Anyway, you MUST change the apxs switch to 

```
--with-apxs2=/path/to/your/apache/bin/apxs
```

Note also, that apache2 has another format of configure file.

Note also, that it is still experimentall...

I think, that for this purpose is better to compile apache2+php

outside of gentoo to /usr/local or /opt without using emerge system.

----------

## wahuu

Hi,

I had the same problem when I tried to install PHP. I figured out that -in my case- the problem was that the apxs script tried to access /usr/bin/envvars, which was installed to /usr/sbin/envvars. Creating a symlink fixed the issue for me. (ln -s /usr/sbin/envvars /usr/bin/envvars)

I have created a very experimental ebuild for Apache2. (pre-alpha) Please feel free to improve it and report any errors but let me warn you. It might not work for you. It does not even compy to the FHS.

http://wahuu.at/~db/downloads/httpd-2.0.36.ebuild

1.) Copy ebuild to /usr/portage/net-www/httpd/

2.) create digest: ebuild httpd-2.0.36.ebuild digest

3.) emerge httpd

To compile php4 just change --with-apxs => --with-apxs2 in the php ebuild.

Dominik

p.s. Please do not post bugs/errors with this ebuild on bugs.gentoo.org!

----------

## Tuxisuau

Why httpd and not "apache"?

Did you submit it?

Masked, it can perfectly be in portage, and that may become an incentive for other people to improve it too  :Smile: 

----------

## wahuu

The reason for naming the ebuild "httpd" was simpy that the Apache package itself is named "httpd". Probably it is more intuitive to name it Apache ... I do not mind.

I have not submitted the ebuild yet. I wanted to discuss it with "woodchip" first but so far I have not received any mail reply. 

Does the Apache2 (httpd) ebuild work for you guys? 

Dom

----------

## Tuxisuau

emerge httpd -> apache

is like

emerge mailclient -> mutt

There are more httpd's than apache, and more mail clients than mutt (yes, really ;).

----------

## wahuu

Hi Tuxisua,

the argument you pointed out is good and convinced me! I have already submitted the ebuild as apache-2.0.36.ebuild to https://bugs.gentoo.org.  :Wink: 

Hasta luego,

Dominik

----------

## theprog

Add this to the pkg_setup() function:

```
select_modules_config || \

    die "couldn't find apache-builtin-mods config file"
```

Add this to the bottom of the ebuild:

```

parse_modules_config() {

    local filename=$1

    local name=""

    local dso=""

    local disable=""

    [ -f ${filename} ] || return 1

    einfo ">>> using ${filename} for builtins..."

    for i in `cat $filename | sed "s/^#.*//"` ; do

        if [ $i == "-" ] ; then

            disable="true"

        elif [ -z "$name" ] && [ ! -z "`echo $i | grep "mod_"`" ] ; then

            name=`echo $i | sed "s/mod_//"`

        elif [ "$disable" ] && ( [ $i == "static" ] || [ $i == "shared" ] ) ; th

en

            MY_BUILTINS="${MY_BUILTINS} --disable-$name"

            name="" ; disable=""

        elif [ $i == "static" ] ; then

            MY_BUILTINS="${MY_BUILTINS} --enable-$name=yes"

            name="" ; disable=""

        elif [ $i == "shared" ] ; then

            MY_BUILTINS="${MY_BUILTINS} --enable-$name=shared"

            name="" ; disable=""

        fi

    done

}

select_modules_config() {

    parse_modules_config /etc/apache/apache-builtin-mods || \

    parse_modules_config ${FILESDIR}/apache-builtin-mods || \

    return 1

}

```

Then you can use the apache-builtin-mods just as before:

```

mod_actions shared

mod_alias shared

mod_asis shared

mod_auth shared

```

----------

