Posts Tagged ‘ Plug-in

How to Fix Warning: Cannot modify header information – headers already sent Error Message in WordPress

After transferring my WordPress site to a new server, I received this error when trying to log in to the WP-Admin panel

Warning: Cannot modify header information – headers already sent by (output started at /home/nnnick/public_html/nickroshon.com/wp-content/plugins/wp-security-scan/scanner.php:63) in /home/nnnick/public_html/nickroshon.com/wp-includes/pluggable.php on line 890

I had no idea what that means, but without being able to log in to the Admin panel it was a little hard to get rid of it. At first I thought about just going in and deleting the plug-in referenced above and seeing if that would work (it did work, although there were many other plugins that were also causing this error, as well as the theme itself, which I didn’t want to delete!). Given I didn’t want to delete all of my plugins as well as the theme itself, I began exploring other options.

Upon doing a Google search for this error, I found many helpful articles, but none that were quite helpful enough – they give tips, but some of the details were a bit fuzzy. This post on WPContempo, as well as these two posts on the WordPress.org forums (1) and (2) were helpful, and explained that:

You likely have an extra white-space or line at the beginning or end of your WP-Config file. Open your WP-Config file and delete an extra white-space at the beginning or end of the file, then delete it.

That is mostly correct, but a little unclear and didn’t totally fix my problem. Here is the dumbed down explanation.

  1. You probably do have extra lines at the beginning or end of a file, although it isn’t necessarily your WP-Config file. If your error message looks like mine above, it is in a specific file related to a plugin, theme, or other add-on to your WordPress install, although its possible your WP-Config file also has extra white space too. During the transfer of your site, some of your files (for whatever unknown reason) grew a few mysterious empty lines at the beginning or end, which screws everything up…  Extra Spaces at End of File WordPress
  2. To find the files with the extra lines, look at the error message itself, as it will tell you exactly which file is causing the issue. At the example at the top of this post, “Warning: Cannot modify header information – headers already sent by (output started at /home/nnnick/public_html/nickroshon.com/wp-content/plugins/wp-security-scan/scanner.php:63) in /home/nnnick/public_html/nickroshon.com/wp-includes/pluggable.php on line 89″ the part bolded is the cause of your problem. It is telling you the Scanner.php file has an extra space on line 63, which happened to be the last line of the file (and sure enough, it was blank).
  3. To fix it, either connect to your site via FTP, or through the File Manager in your cPanel (note: connecting via FTP is better as the cPanel may add extra lines itself, although I had no problem doing this through the cPanel myself). Within either your FTP or cPanel File Manager, navigate to the location of the file causing the problem (public_html/nickroshon.com/wp-content/plugins/wp-security-scan/) in this example, and then open the file name referenced (scanner.php). Look for the line number after the colon, again in this example line 63. Remove the extra lines starting at that line number, and then save the file and close it.
  4. Try reloading your WP-Admin page. Chances are you’ll see the same error message again, only a new file is causing the problem…repeat steps 2-3, looking for that exact file and line number and removing spaces. With one of my rather customized blogs I had to do this probably 10 times before I could get rid of all the error messages, but eventually I had corrected all of them, and am now able to log in to my WP-Admin just fine!

And that’s it – I hope this was helpful to others out there that may have had some problems like me. It is definitely something you can figure out, even if you’re not an expert programmer – you just need a little patience as it is a tedious process of hunting for extra spaces and lines.

The First Three WordPress Plugins You Should Install

WordPress Admin Panel

I’ve recently started yet another WordPress blog (just like the default tagline says), bringing my total count up to four active blogs that I control. Now that I’m starting to get the hang of this, here are the first plugins I recommend installing right away on your new WordPress blog to kick things off on the right foot:

  1. Akismet – this blocks comment spam. If you don’t have this plugin, or one like it, you probably spend all day moderating your comments, or your blog is so new even spammers haven’t found it yet – but trust me, they will. Install Akismet and 99.9% of your spam problems will go away.
  2. WP Security Scan – after getting hacked last year, I realized WordPress has some pretty significant security flaws – since its open source, anyone can read the back end code and figure out how it all works – and everyone shares the same basic platform, which means that once you learn to hack one WordPress blog, chances are you can hack just about any of them. WP Security Scan both scans and fixes your WordPress blog for most common vulnerabilities, which will make it much harder for hackers to gain unauthorized access to your blog compared to the average WordPress install. This plugin takes seconds to install, but will save you hours of headache if a hacker every targeted you.
  3. WP Minify – a fast loading blog is a healthy blog. WP Minify compresses Javascript and CSS files to improve page load time. It’s well known within the SEO community that Google uses page load speed as part of their ranking algorithm, so every second you can shave off that loading speed can only help.

Of course, this list would be incomplete without mentioning two other things you should do as soon as you start a new blog:

  1. Sign up and verify your site in Google Webmaster Tools – this will alert you of any issues Google has crawling your site, as well as a wealth of other data like inbound links, relevant keywords, and much more. It will also get your site crawled by Google sooner rather than later, so you’ll start showing up in the search results.
  2. Sign up and implement Google Analytics, either using a plugin like Google Analytics for WordPress or manually inserting your tracking code into the footer. This will help you monitor site performance over time, and find referring networks that you can interact & engage with to grow a loyal base of readers to your blog. And since Google Analytics is completely free, there is no sense not collecting this data, even if you don’t plan on using it right away – in a few months, you’ll probably be interested and wish you had been tracking your site since the beginning.

I hope this was helpful – let me know if I left off any good suggestions in the comments section below!

I’ve Been HACKED!

Hackers (film)

Image via Wikipedia

I really need to get off a shared server. It’s cheap, but then you could be sharing your server with someone up to no good…

Also, time to install a boat-load of security plug-ins. My blog was hacked by accessing the wp-config.php file, and this site has a good tip on how to lock that down, as well as encrypting passwords and other stuff: 18 Plugins & Hacks to Protect Your WordPress Blog

I’ve deleted any information about the hacker since he told me how he was able to hijack my blog – luckily, he only got into the wordpress admin and not the server or any of the backend. I will be moving everything to a new server soon – stay tuned, and pardon any interruptions in the meantime.

Reblog this post [with Zemanta]