• Blogging
  • Freebies
  • Freeware
  • How-To
  • Make Money Online
  • Mobile
  • Home >> Blogging >> Blog Related >> WordPress Blog showing Premature end of script headers in Error Log and showing Error 500 Internal Server Error

    WordPress Blog showing Premature end of script headers in Error Log and showing Error 500 Internal Server Error

    Yesterday, this blog was down for an hour an so. During that time, any visitor visiting my blog was getting the the page with the following error:

    500 Internal Server Error

    Wordpress Blog showing Premature end of script headers in Error Log and showing Error 500 Internal Server Error
    Even for me, when i was trying to open WordPress Admin or WordPress Dashboard. I was getting 500 Internal Server Error.

    I was surprised as to why it is happening? I was sure that i didn’t make any big change like Installing WordPress Plugin or Deactivating WordPress Plugin or Modifying .htaccess file or making any changes to WordPress Core files.

    I then logged into my CPanel and checked the error_log file. I was surprised to list of the below error messages:

    Premature end of script headers: index.php

    Infact, for every post or pages accessed. The same error was getting logged into error_log file.

    It took nearly an hour to find out the problem and resolve the issue. Below i will be providing the solution so that you can also get problem resolved (if you have it)

    Solution to Premature end of script headers and 500 Internal Server Error on WordPress Blog:

    1. If your website / WordPress blog starts showing up – “500 Internal Server Error”, then the below solution might resolve it.
    2. Login to your host, it could be CPanel Control Panel or Plesk Control Panel.
    3. If your host uses CPanel, then open the File Manager and look for error_logfile
    4. If your host uses Plesk, then go to “Log Manager” and look for error_log file
    5. Open the file and look for the error messages like : “Premature end of script headers”
      Look for the timestamps. If the timestamps on each of the above error message is most recent then, this is the problem for your 500 Internal Server Error
    6. If you see those error messages then there are actually two solutions for Premature end of script headers
    7. Solution 1 : Increase the Memory Limit in PHP.INI file : The php.ini has one line where you can set Memory Limit for the PHP to be used when executing PHP Scripts. Look for the php.ini file, If found look for the following line:
      memory_limit = 32M  ; Maximum amount of memory a script may consume (32MB)

      Now change it to 64M or whatever XXM of your choice and try reloading your website or blog.

      If problem is resolved skip the below steps.

      1. If you can’t find the php.ini then, there is one more way of setting Memory limit for PHP. You can set the Memory Limit for PHP using .htaccess file.
      2. Make sure you first take a backup of .htaccess file.
        Open .htaccess file and add the following line and save the file.

        php_value memory_limit 64M

        Now try reopening your website or blog. If problem is resolved skip the below steps.

    8. Solution 2 : delete .htaccess file : Yes, by deleting the .htaccess file. You can get rid of Premature end of script headers and 500 Internal Server Error
      1. Make sure you first take a backup of .htaccess file..
        After taking taking the backup of .htaccess file. Now delete the file. You can find the .htaccess file in the root directory of the web server.
      2. Now try opening the website or Blog. You should be able to load the website. If succeeded, then there is one more step for WordPress Blog owners before you blog comes back to normacy
      3. Login to your WordPress Dashboard and go to Settings -> Permalinks and Click on Save buttonThis will recreate or regenerate the .htaccess file.
      4. If you are using WP-Super Cache Plugin, then go to Settings -> WP Super Cache. You should definitely see lots of code showing that this needs to be added to .htaccess. Click on the button so, that the WP Super Cache code will be appended to your .htaccess file.

    Hope this post helps you in c.

    Solution 2 resolved the issue for me.

    You can refer to the following links for more help. I used the below links to resolve this problem:

    IMPORTANT: This blog welcomes Guest Bloggers, Writers to also contribute by writing Guest Posts and also Make Money!. Check out our Revenue Sharing Program
    1924 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below:


    1. Anish K.S says:

      Thanks Nihar for the info, once i faced an issue no posts found, one table crashed, repaired that table and fix issue.

      I will save this for future.
      .-= Anish K.S´s last blog ..CSC Announces Version 2.0 of its FirstPoint Document Management and Collaboration Solution =-.

    2. Glad to see that you’ve fixed the issue, I’ve had similar issues with certain plugins on my blog. My question is with some of the settings on .htaccess, does the server set that up, the first time the .htaccess file is viewed? And from that point, its its good to go? Or does every time you connect to the web page, its at that time that the setting is changed? I ask this because I’ve made some changes via .htaccess but I am unsure if I have to still leave the change in there.

    3. Thanks man for this valuable info. I think my problem is solved but I will have to check my error log tomorrow to be sure.

    4. Leo Borges says:

      Thanks, the .htaccess trick did the trick. Just put at my root dir and all my wordpress sites are working just fine. I was getting this error at all my websites, in every page. Sometimes the page was shown, sometimes the error 500 appeared. Looking at my apache log, I see that every site produced a Premature end of script headers: index.php error. I know DreamHost limits the file size to 8mb. Since I never messed around with php.ini files, I put the 1 php_value memory_limit 64M and the errors stopped. Tomorrow I’ll see my error logs to verify, but thanks in advance for the solution!

    5. Clove says:

      thanks,now i know how to fix it.
      but,something is still wrong with me
      1. i delete .htaccess
      2.i can visit my website
      3.set my permalinks /%post_id%.html,my blog shutdown again.
      how to do it?

    6. Randy says:

      Added “php_value max_input_vars 5000” to the .htaccess file and the errors went away. (GoDaddy VPS hosting)

    Leave a Reply

    page counter
    NiharsWorld RSS Feed