Get php fatal error when trying to go into owncloud

Please help us by providing the following info. Before posting please also check the pinned "Known issues" threads and make sure that you're running the latest available version for your oC release:

Steps to reproduce
1.try to access

Expected behaviour
Tell us what should happen
I should get the login screen
Actual behaviour
Tell us what happens instead
I get php fatal error and after enabling php_startup_errors and display_errors I get the following in my php error log
[05-May-2017 11:44:21 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/ on line 542
[05-May-2017 11:44:21 UTC] PHP Stack trace:
[05-May-2017 11:44:21 UTC] PHP 1. {main}() /var/www/
[05-May-2017 11:44:21 UTC] PHP 2. require_once() /var/www/
[05-May-2017 11:44:21 UTC] PHP 3. OC::init() /var/www/
[05-May-2017 11:44:21 UTC] PHP 4. set_time_limit() /var/www/

Server configuration
Operating system: Gentoo linux
Web server:apache 2.4
PHP version:5.6
ownCloud version (see ownCloud admin page):9.1.0
Updated from an older ownCloud or fresh install:updated
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):

ownCloud configuration

Go to the admin page, click on 'admin' -> 'Generate Config Report' -> 'Download ownCloud config report' or use the command line `sudo -u www-data php occ config:list system` (please sanitize sensitive data)
    "system": {
        "instanceid": "occc0c1ec9dc",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "\/var\/www\/\/htdocs-secure\/owncloud\/data",
        "dbtype": "pgsql",
        "version": "",
        "dbname": "owncloud",
        "dbhost": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "forcessl": true,
        "loglevel": "1",
        "theme": "",
        "maintenance": false,
        "overwrite.cli.url": "\/owncloud",
        "trusted_domains": [
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto",
        "debug": false,
        "mail_smtpmode": "smtp",
        "mail_from_address": "owncloud",
        "mail_domain": "",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "localhost",
        "mail_smtpport": "25"

ownCloud log (data/owncloud.log)
nothing in the log about this error
Please paste possible errors in the following code block, see for more info

Integrity status for oC9+
everything checks

Login as admin user into your ownCloud and access
paste the results here.

You should really update to 9.1.5 first as advised in your old thread before searching and reporting issues in such an outdated version.

I did try that at some point, but it did not fix the problem and so went back to the version I had. At first, I thought it was the database and I did the upgrade, but it gave me the same symptoms, although at the time, I had no way of seeing the actual php error.

Also, It looks like I have the same problem when I use the davfs client. It takes a long time, but does eventually mount. Now, if I comment out the line and the following two lines, I can actually access the server, but I know I cannot leave it this way.