# Very Simple circle.yml fails to start Apache

**URL:** <https://discuss.circleci.com/t/very-simple-circle-yml-fails-to-start-apache/13919>\
**Category:** Build Environment\
**Tags:** apache, config\
**Created:** [July 3, 2017, 5:50am UTC](https://discuss.circleci.com/t/very-simple-circle-yml-fails-to-start-apache/13919 "2017-07-03T05:50:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeschinkel](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mikeschinkel/32/16453_2.png) [@mikeschinkel](https://discuss.circleci.com/u/mikeschinkel)\
**Post date:** [July 3, 2017, 5:50am UTC](https://discuss.circleci.com/t/very-simple-circle-yml-fails-to-start-apache/13919/1 "2017-07-03T05:50:16Z")

</div>

I am new to CircleCI. I’ve tried almost 30 different builds to get something, anything to work, and whittled down the a very simple `circle.yml` and still getting failure. The last `circle.yml` I tried is:

```
machine:
  timezone:
    America/New_York

  php:
    version: 5.6.22

dependencies:
  post:
    - sudo service apache2 restart

test:
  override:
    - echo 'No tests, just say us Okay!'

```

The command and subsequent error message follows, and I used SSH to debug and the `/usr/lib/apache2/modules/libphp5.so` file was definitely there _(as a symlink)_. I even tried `chown`ing it to `www-data:www-data` but that did not help either:

```
$ sudo service apache2 restart
 * Restarting web server apache2
   ...fail!
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
sudo service apache2 restart returned exit code 1
Action failed: sudo service apache2 restart

```

Any ideas what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![mikeschinkel](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mikeschinkel/32/16453_2.png) [@mikeschinkel](https://discuss.circleci.com/u/mikeschinkel)\
**Post date:** [July 4, 2017, 6:53am UTC](https://discuss.circleci.com/t/very-simple-circle-yml-fails-to-start-apache/13919/2 "2017-07-04T06:53:08Z")

</div>

So it seems that a simply misconfiguration on CircleCI’s part sent me down a rabbit hole for hours. ☹

I eventually found the answer [**here**](https://discuss.circleci.com/t/apache2-and-php-missing-libphp5-so/3300/6).

Seems that `/usr/lib/apache2/modules/libphp5.so` was symlinked to the wrong directory `/home/ubuntu/.phpenv` instead of the correct directory `/opt/circleci/.phpenv`.

The full path to symlink to should be `"${PHPENV_ROOT}/versions/$(phpenv global)/usr/lib/apache2/modules/libphp5.so"` where `${PHPENV_ROOT}` provides `"/opt/circleci/.phpenv"` and `$(phpenv global)` provides the PHP version number, such as `"5.6.22"`.

This is what I had to add to my `circle.yml` file to **finally** get it to work:

```
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"

```

This is a serious landmine for wasting time, and it makes my first user experience of CircleCI less than positive. I hope the rest of CircleCI is not filled with other gotchas or I will wish I had chosen a different platform.

---

<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:39am UTC](https://discuss.circleci.com/t/very-simple-circle-yml-fails-to-start-apache/13919/3 "2018-06-18T11:39:39Z")

</div>


