I have 3 Drupal 8 sites. 2 have premium themes and one is Bartik themed.

When I built the 2 the sites with premium themes in Ubuntu I could log in fine but when I log in to them when online (CentOS server) the sites crashes with the error:

The website encountered an unexpected error. Please try again later.

This doesn't happen with the Bartik site.

I wonder if I could debug the problem somehow with Drush or if there is anything else than drush wd-show just to make sure I cover the most I can with it?

The only way I know to debug problems with drush is drush wd-show.

Is there any command that could help me understand why site logins fail on that particular environment?

Update - Error from Drush & Cpanel error log:

[Tue Jul 19 14:50:11.393827 2016] [:error] [pid 15721] [client] Uncaught PHP Exception RuntimeException: "Failed to start the session because headers have already been sent by "/home/zantech0/public_html/yoursitename.com/themes/business/includes/skins-menu/skins_menu.inc" at line 2."

at /home/zantech0/public_html/yoursitename.com/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 140, referer: http://yoursitename.com/user/login

Head of the file:

enter image description here


That error is often caused by PHP files that generate output they should not. Generally it's caused by errors like having a closing ?> and then a blank line at the end of the file. It's possible that a blank line was added during whatever process you used to move the file to the production server (git, lots of editors, and a few FTP clients will sometimes do this automatically).

In your case I would check /home/zantech0/public_html/yoursitename.com/themes/business/includes/skins-menu/skins_menu.inc to see if it does something that generates output (and therefore triggers PHP to send response headers).

  • I haven't learned enough on PHP to debug it but the head of the file seems corrupted - I've updated the question with an image - Please note the colorless php opening tag in notepad++. The file doesn't have a closing tag though... – JohnDoea Jul 19 '16 at 21:06
  • 1
    That blank line at the start is the problem. The very first thing in the file should be <?php not a blank line. – acrosman Jul 19 '16 at 21:18

Not all errors, especially if you are installing drupal on a new server, are logged in drupal (drush wd-show).

An example is if there is an error in settings.php in the database settings.

To debug this check the php settings:

Is there a line log_errors = On?

Then locate the error in the error log of the webserver.

Or set the php option display_errors = On to get the error on screen. But remember to remove this on the production server after you found the error.

  • Sorry I didn't mention... This is a shared server so I can't easily change the environment's php.ini (maybe you meant to the Drupal site's own php.ini ?)... In any case I took a look in the Cpanel error log and found the following error pasted above in the question. – JohnDoea Jul 19 '16 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.