# How to Install Apache 2.4 in its own directory?



## Mayhem30 (Jul 9, 2014)

I'm trying to install Apache 2.4 using the ports system `make install clean` and I'm receiving this error message :


```
===>  apache24-2.4.9_4 conflicts with installed package(s): 
      apache22-2.2.27_4

      They install files into the same place.
      You may want to stop build with Ctrl + C.
^C
localhost#
```

I was hoping to have both 2.2 and 2.4 installed so I can make the necessary changes to httpd.conf and my vhosts before switching over.

Anything I can do to fix this issue?


----------



## Mayhem30 (Jul 10, 2014)

I just updated Apache 2.2 on another machine and received this new message*:*


```
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                      H E A D S - U P
2014-07-11:
  The default version will change from www/apache22 to www/apache24,
  pre-build apache modules will also reflect this!

  In case ports are build by yourself and apache22 is required
  use the following command to keep apache22 as default

  echo "APACHE_DEFAULT=2.2" >> /etc/make.conf

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
```

Why are we not given the option to install Apache 2.4 separately?

How are we expected to transition to Apache 2.4 without testing our httpd.conf and vhosts first?


----------



## SirDice (Jul 10, 2014)

Mayhem30 said:
			
		

> How are we expected to transition to Apache 2.4 without testing our httpd.conf and vhosts first?


Here's a novel idea, use a test server.


----------



## wblock@ (Jul 10, 2014)

It's a hassle, but it worked for me.  The utterly weird Allow, Deny syntax is gone, replaced by an only mildly weird Require syntax.  And far fewer modules are enabled by default.


----------



## Mayhem30 (Jul 10, 2014)

SirDice said:
			
		

> Mayhem30 said:
> 
> 
> 
> ...



If that was an option for me, I wouldn't be on here asking for help ...


----------



## wblock@ (Jul 10, 2014)

Create a jail?


----------



## SirDice (Jul 11, 2014)

Heck, even a virtual machine on a laptop will do.


----------



## Mayhem30 (Jul 11, 2014)

Thank you for the suggestions, but none of them are possible for me.

I'll just go in blind and hope for the best.


----------



## ghostcorps (Jul 18, 2014)

Hi Guys,

 I am looking to upgrade to 2.4 and read on another thread that they could be installed side by side, this makes sense as the warning in UPDATING advises how to set 2.2 as default. Also the info here is pretty straight forward: https://httpd.apache.org/docs/trunk/upgrading.html

 Is the warning in the OP just a warning or will 2.4 actually overwrite 2.2 files? I can do the test server thing but if UPDATING suggests they can be installed side by side, I would rather a confirmation before spending more hours.

Thanks in advance


----------



## ShelLuser (Jul 18, 2014)

Of course the best solution is to use a test server or probably even easier: a test jail. However, having said that, the FreeBSD ports system is much more flexible than some of you seem to credit it for (personal impression mind you). It's perfectly possible to install Apache 2.4 into its own directory, you simply need to by-pass the ports system.

And the ironic part is that this is perfectly doable by using that same ports system (it's also why the Ports collection is my all-time favourite way for software distribution).

However, before I continue, keep in mind that this is still a little bit of a hack because you're by-passing the package manager. It's perfectly usable for testing purposes, but obviously you should replace Apache 2.2 with 2.4 in the way it was intended.

So; my suggestion would be to start by using `# make extract` in the www/apache24 ports directory. You can even ignore the configure part somewhat, but I'd strongly suggest to follow up with a `#make rmconfig` when you're done so that you can configure Apache in the way it was intended when you're going to install it for real.

Now go into the working directory (/usr/ports/www/apache24/work/httpd-2.4.9) and from that point on use the configure script to set everything up. Start by checking out the options which you need to use by running `#./configure --help | less`.

The option which you most definitely want to use is `#./configure --prefix=/usr/local/apache24` which will make sure that your Apache setup will be installed in its own separate directory; /usr/local/apache24.

That should give you all the options you need to check it out and do some testing before you will implement it for real.


----------

