Very Simple circle.yml fails to start Apache

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:


    version: 5.6.22

    - sudo service apache2 restart

    - 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/ file was definitely there (as a symlink). I even tried chowning it to www-data:www-data but that did not help either:

$ sudo service apache2 restart
 * Restarting web server apache2!
 * 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/ into server: /usr/lib/apache2/modules/ 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?

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

I eventually found the answer here.

Seems that /usr/lib/apache2/modules/ 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/" 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:

    - sudo unlink "/usr/lib/apache2/modules/"
    - sudo ln -s "${PHPENV_ROOT}/versions/$(phpenv global)/usr/lib/apache2/modules/" "/usr/lib/apache2/modules/"

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.