pdo – PHP – Error message: malformed header from script

The code is working normally on the localhost, the problem was when I put it inside the hosting

When I'm going to do the closing on the panel

  
  
  Get out of the system
  

In the event of an error in the internal server,

Internal Server Error!
The server has encountered an internal error and can not complete your request.
Error message:
malformed header from script. Bad header = login2.php: panel2.php

the php code of the panel is


And it ends with the closing of session at the end of the page with the code, which returns to the login page


I would like to understand and resolve it because it works on my local server and when it goes to internal it does not ..