Site displaying unrendered HTML on AND after install? Ub18.04, NC15 and NC16


I have a working Ubuntu 18.04 server with MySQL 5.7.25, PHP 7.2.17 and Apache 2.4.29. Virtual servers are properly configured and I have a number of working PHP sites. I went through the NC docs to confirm that I’ve installed and enabled all of the required PHP and Apache modules.

I’ve tried installing both NC15 and the latest NC16.0.0 (just released) multiple times now, and I always experience the same problem: the site pages display as raw HTML and aren’t rendered.

  • When I attempt to install via the web interface, I only see the raw HTML rendered by the index.php file, with a ton of links to scripts, and then a message saying that I need to enable Javascript. I confirmed by explicitly going to /index.php that I’m viewing rendered HTML from that page, and not index.html. It’s as if the pages are being served as text/plaintext instead of text/html.

  • When I try to install via OCC on the command line, it reports a successful installation. But then when I visit the website, I’m redirected to /index.php/login and I see another screen full of raw HTML, presumably what the rendered index.php looks like after installation when lots of resources are being called. This one includes some clear Javascript variables in the body, such as

    var oc_debug=false;
    var oc_isadmin=false;
    var backendAllowsPasswordConfirmation=true;
    var oc_dataURL=false;
    var oc_webroot="";
    var oc_appswebroots=

(I’ve pasted that in exactly as it appears – should the oc_webroot have a value at this point?)

I created an info.php file for that folder and it displays the same broken way – just visible HTML for what the usual php info table page looks like.

When I temporarily disable .htaccess in the root folder, my info.php file DOES correctly display the standard php info page. But the index.php still displays just as raw HTML. So there must be something in the .htaccess settings that’s conflicting with something in my Apache config, right?

The SITEROOT/data/nextcloud.log file is empty. I checked the Apache log (and even kicked up error reporting to “debug”) and it’s just a list of successful SSL requests with no errors.

Any advice? I’ve never seen something like this and I’m not sure where to look next.

Thanks in advance!


So this definitely is a configuration issue in my opinion. The PHP interpreter is not called correctly or something like that.

You should post a few of your configs so we can check.

  • config.php (from nextcloud install dir; REMOVE sensistive information before posting!)
  • apache site config
  • .htaccess (which you think causes issues)

Due to the fact that PHP is used as a command line tool (CLI) and also as a web server component (WEB) different results are possible. You wrote that the installation succeeded on the command line so the web server configuration most likely need to be improved.

Are you sure that PHP has correctly installed on your server? Usually a php-fpm package need to be installed as described here.
Once this has been confirmed you should be able to check the PHP server configuration by creating e.g. a file info.php, which contains this command <?php phpinfo() ?>, and which displays detailed PHP information when called.

As always, I appreciate the suggestions. But on a lark, I tested a couple of other things that I think have ruled out any sort of system-wide PHP problem:

  • My NextCloud instance DOES work perfectly in Firefox; it only displays the broken raw-HTML version in Chrome. So I don’t think it’s a PHP problem.
  • I downloaded and tested OwnCloud on a separate virtual server and it behaved the exact same way as NextCloud: displays fine in Firefox, displays broken raw-HTML in Chrome.
  • ALL of the other PHP sites on this server work perfectly and they always have since I built this server last year (Drupal 7 and 8, Wordpress 5, GeoNode, custom PHP apps), so I know the general LAMP stack is functional.
    (I know it is possible that our default apache-site.conf file that we use to create our virtual servers has a conflict with a PHP setting in NC’s .htaccess but I have no idea what that would be! Any ideas?)

So at this point I’m wondering if it’s some sort of HSTS problem or something, and that’s why it won’t show up in Chrome. I confirmed the trusted domain part of the config file is set up with my domain. I’ve confirmed I’m using the latest Chrome on ALL 3 of my affected devices, and I’ve confirmed that my LetsEncrypt cert is green and valid both manually and with an automated scanner. Definitely a browser problem but what?! :slight_smile:

Thanks again for any suggestions!

Now that would be a very nice information to have right at the beginning, in the initial post :wink:
Knowing that now, I totally agree, that it isn’t a general issue with PHP setup on the server.

Now I think it is a Chrome issue :stuck_out_tongue:
(I wonder anyway why one is taking privacy serious enough to choose NC over Google drive, but still use Chrome on the other hand :stuck_out_tongue: )

Chrome has a browser console as well, right? Are there any error messages which might help to find out why Chrome blocks dynamic content?
Do you use Addons which may block Java-Script or something like that? Could you run Chrome in some kind of “safe mode” without any plugins?

Oh and the .htaccess part is interesting as well. Could you post your .htaccess from the root directory?