# Apache2 and PHP - missing libphp5.so

**URL:** <https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300>\
**Category:** Bug Reports\
**Tags:** apache, php\
**Created:** [April 12, 2016, 5:58pm UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300 "2016-04-12T17:58:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedrosland](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/pedrosland/32/2439_2.png) [@pedrosland](https://discuss.circleci.com/u/pedrosland)\
**Post date:** [April 12, 2016, 5:58pm UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/1 "2016-04-12T17:58:03Z")

</div>

I’m trying to run selenium tests with Apache2 and PHP 5.6. I seem to be running into some issues where the yaml file doesn’t seem to produce the documented behavior.

I’ve looked at the docs here [https://circleci.com/docs/language-php/](https://circleci.com/docs/language-php/) and there are a few things that don’t seem to be correct.

By default, the LoadModule path in `/etc/apache2/mods-enabled/php5.load` is incorrect. I tried to update it to `/home/ubuntu/.phpenv/versions/$(phpenv global)/libexec/apache2/libphp5.so` as per the docs but this fails too as there is no `~/.phpenv`.  
I changed the path to be `/opt/circleci/.phpenv` but the libexec directory is empty.

I searched the entire disk:  
`sudo find / -name '*php*.so'`  
and found this file:  
`/usr/lib/apache2/modules/libphp5.so`  
which is a symlink:  
`/usr/lib/apache2/modules/libphp5.so -> /home/ubuntu/.phpenv/versions/5.6.17/libexec/apache2/libphp5.so`  
but as we’ve already discovered, `~/.phpenv` doesn’t exist.

What is the correct way to get Apache2 and PHP 5.6 running as a module for browser testing?

---

<div class="post-metadata">

**Author:** ![MPLew-is](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mplew-is/32/6592_2.png) [@MPLew-is](https://discuss.circleci.com/u/MPLew-is)\
**Post date:** [April 12, 2016, 6:50pm UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/2 "2016-04-12T18:50:40Z")

</div>

This isn’t a great solution, since it doesn’t allow you to actually select your PHP version, but just leave the `machine/php` section off of your `circle.yml` file. The container will default to PHP 5.6.17, and it seems to be correctly configured out-of-the-box. This is the only solution I’ve found that allows me run PHP, as even recompiling PHP in every build didn’t work for me.

---

<div class="post-metadata">

**Author:** ![kimh](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kimh/32/19_2.png) [@kimh](https://discuss.circleci.com/u/kimh)\
**Post date:** [April 21, 2016, 2:11am UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/3 "2016-04-21T02:11:21Z")

</div>

@pedrosland What build image are you using? Is it Ubuntu 12.04 or 14.04? If 14.04, then can you try replacing `~/.phpenv` with `$PHPENV_ROOT` ?

---

<div class="post-metadata">

**Author:** ![pedrosland](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/pedrosland/32/2439_2.png) [@pedrosland](https://discuss.circleci.com/u/pedrosland)\
**Post date:** [May 2, 2016, 2:59pm UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/4 "2016-05-02T14:59:04Z")

</div>

@MPLew-is Thanks for your tip.This does seem to work correctly. Strange that it would break even when specifying the same version. I do as you suggested but I decided to build a docker image and cache it for subsequent builds instead.

@kimh I was using Ubuntu 14.04.

I switched to using Docker. While it took a while longer, I’m happy with the result and it is more portable.

---

<div class="post-metadata">

**Author:** ![kimh](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kimh/32/19_2.png) [@kimh](https://discuss.circleci.com/u/kimh)\
**Post date:** [May 2, 2016, 3:43pm UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/5 "2016-05-02T15:43:29Z")

</div>

@pedrosland

**tl;dr** I just rebuilt PHP 5.6.17 with php module support.

```auto
machine:
  php:
    version: 5.6.17

dependencies:
  override:
    - curl -s https://packagecloud.io/install/repositories/circleci/trusty/script.deb.sh | sudo bash
    - sudo apt-get install circleci-php-5.6.17=2

```

With the circle.yml above, `$PHPENV_ROOT/versions/5.6.17/usr/lib/apache2/modules/libphp5.so` should be available which you can copy to your apache directory.

In Ubuntu 12.04 build image we were using our forked php-build which generates the php module under `libexec/apache2` directory.

In 14.04 build image, we instead use upstream php-build which generates the php module under the somewhat strange directory: [https://github.com/php-build/php-build/blob/9c51240014c1e22f09e8db17f67718f17e8fd69a/bin/php-build#L578](https://github.com/php-build/php-build/blob/9c51240014c1e22f09e8db17f67718f17e8fd69a/bin/php-build#L578)

I’m now rebuilding all PHP packages to make sure to include the apache module so that you don’t have to download everytime. Once they are preinstalled, I’ll update our doc to specify the location of the php module.

Please let me know if the circle.yml doesn’t work for you.

---

<div class="post-metadata">

**Author:** ![yourilima](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/yourilima/32/13289_2.png) [@yourilima](https://discuss.circleci.com/u/yourilima)\
**Post date:** [June 17, 2016, 11:51am UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/6 "2016-06-17T11:51:44Z")

</div>

this seems to do the trick for me. it also takes the version set earlier into account

```
dependencies:
  pre:
    - sudo unlink /usr/lib/apache2/modules/libphp5.so
    - sudo ln -s $PHPENV_ROOT/versions/$(phpenv global)/usr/lib/apache2/modules/libphp5.so /usr/lib/apache2/modules/libphp5.so
```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:34am UTC](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/7 "2018-06-18T11:34:05Z")

</div>


