title: How to determine 500 error and show custom error message
body: <p>I am trying to import some data from an excel sheet then insert this data in my database, what i want is that if the user uploaded huge amount of entries lets say 16000 entry in excel sheet and tried to upload huge amount of data on my server then the server shows 500 internal server or server to handle this request on browser so i have to catch this error in php server side and show my custom message to the user.</p>
  
  <p>For this i have tried to catch this but it is not working, so please help me.</p>
  
  <pre><code>&lt;?php
      ini_set('display_errors', 1);
  
      function import_client()
      {
          try
          {
              //my php code in this i am reading excel
              //sheet data and inserting in my database.
          }
          catch (Exception $e) 
          {
              echo "you are importing huge data
              hence server will not unable to handle this request";
          }
      }
  ?&gt;
  </code></pre>