# Different containers for httpd and php

**URL:** <https://forums.docker.com/t/different-containers-for-httpd-and-php/28707>\
**Category:** General\
**Tags:** docker\
**Created:** [February 21, 2017, 8:20pm UTC](https://forums.docker.com/t/different-containers-for-httpd-and-php/28707 "2017-02-21T20:20:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpcdb](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@wpcdb](https://forums.docker.com/u/wpcdb)\
**Post date:** [February 21, 2017, 8:20pm UTC](https://forums.docker.com/t/different-containers-for-httpd-and-php/28707/1 "2017-02-21T20:20:22Z")

</div>

We are very new to docker and have a question we’re hoping to get some assistance on so please bare with us.

I’m on a mac with El Capitan running Docker 1.31.1 and docker-compose 1.11.1.

We’ve created 2 images based on the amazonlinux images, one with php5.6 and one with httpd2.4.

We were hoping to have 2 containers, one for each and make it easier for our devs to try new versions of php when needed. Is it possible to have the httpd container use the php from the other container? I used a docker-compose.yml to set them up and both containers run fine. I can ping the php container from within the httpd container but it doesn’t see the php install in that container.

I would appreciate any help that anyone is willing to give.

---

<div class="post-metadata">

**Author:** ![think](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/think/32/14641_2.png) [@think](https://forums.docker.com/u/think)\
**Post date:** [February 23, 2017, 7:02pm UTC](https://forums.docker.com/t/different-containers-for-httpd-and-php/28707/2 "2017-02-23T19:02:37Z")

</div>

you could map the php-binary and all libraries into your httpd container.  
but this is quite flaky.  
I would go for one container containing httpd and php. The php process anyway will run within the httpd-container.

---

<div class="post-metadata">

**Author:** ![wpcdb](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@wpcdb](https://forums.docker.com/u/wpcdb)\
**Post date:** [February 28, 2017, 4:30pm UTC](https://forums.docker.com/t/different-containers-for-httpd-and-php/28707/3 "2017-02-28T16:30:32Z")

</div>

Thank you for your time.

I took your advice and went the one container route and just built a second image with different php version.

Thanks again.
