Phpunit tests are showing 500 errors always on build

apache
circle.yml
php7.1

#1

Hi,
We have a php application having the following yml data

  staging:
    branch: master
    heroku:
      appname: uat-tp
machine:
  pre:
    - sudo apt-get update; USE_PRECOMPILE=true sudo -E circleci-install php 7.1.0
  php:
    version: 7.1.0
  environment:
    BROADCAST_DRIVER: log
    CACHE_DRIVER: file
    SESSION_DRIVER: file
    QUEUE_DRIVER: sync
    REDIS_HOST: 127.0.0.1
    REDIS_PASSWORD: null```

But the builds are always failing with 500 internal server error on phpunit. The phpunit has some integration tests, which needs to ping the web url, so returning always 500 internal server error. But when I logged into the build via ssh, It showed me some weird things,

when I ran following command : curl -XGET 'http://localhost', It returned connection refused error. When I tried to find the apache settings, I found apache2 not running. Then I tried to restart the apache2, it showed me following error:
* Starting 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/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.

The point to notice here is that, I configured php version 7, but version 5 errors are there. Can Anyone please help me to resolve this? Is it any error to yml config, or some error on the circleCI.

Thanks

#2