1

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 79.177.142.239:33948] 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

2 Answers 2

5

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).

2
  • 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...
    – user16289
    Jul 19, 2016 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, 2016 at 21:18
1

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.

1
  • 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.
    – user16289
    Jul 19, 2016 at 20:50