PHP 7.0 and Apache2

Hello,

I’m not sure if this is an error, but I can’t find any other explanation. So here is my circle.yml file:

machine: php: version: 7.0.7 dependencies: pre: - sudo service apache2 restart

And I get this error message:

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

I’m using image Ubuntu 14.04 (Trusty). I’ve spent a lot of time on this issue, I’ve cut all unnecessary things created public project: https://github.com/PetrHudik/circle

1 Like

Came across the exact same problem and figured it out, add this to your circle.yml:

dependencies:
  post:
    - sudo rm /etc/apache2/mods-enabled/php5.load

And this to your apache host file:

Listen 8080

<VirtualHost *:8080>
  LoadModule php7_module /opt/circleci/php/7.0.7/usr/lib/apache2/modules/libphp7.so
  
  # ... other directives

</VirtualHost>
3 Likes