April 20 2015

WordPress showing garbage characters on front page



----------------------------------------------------------------------------
I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.

----------------------------------------------------------------------------

After installing the W3 Total Cache plugin for WordPress, I noticed that my front page wasn’t rendering properly in some browsers including Internet Explorer (Chrome seemed fine).  For example:

More garbage than usual....
More garbage than usual….

There were many forum posts on this but none of the answered seems to help.  There is even a section in the plugin FAQ however this wasn’t the solution for me:

I see garbage characters instead of the normal web site, what’s going on here?

If a theme or it’s files use the call php_flush or function flush that will interfere with the plugins normal operation; making the plugin send cached files before essential operations have finished. The flush call is no longer necessary and should be removed.

For me, the issue was HTTP (gzip) compression.  I needed to disable this.  In the  W3 Total Cache plugin, under Browser Cache, I deselected the Enable HTTP (gzip) compression option and the website started working properly again.

 



----------------------------------------------------------------------------
I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.

----------------------------------------------------------------------------

March 30 2015

Why I moved from Windows Azure to Amazon AWS….

After using Windows Azure to host my WordPress blog for around 6 months, I eventually lost patience with their product offering and support team and starting looking elsewhere.  I was receiving ongoing database connection issues and intermediate site outages.

Failing database connections…

The “This site is currently not available… please try again later” message became very common.  This is due to the way Azure manages it’s resource limitations – while other providers will simply throttle your site once you reach a certain level of CPU or RAM usage, Azure actually stops all connections to your website and takes it offline.   If you ran a large corporate website, you would enable to scaling options that will allow the instances to grow when there is increased demand however this comes at a financial costs and for me, I couldn’t justify it for a “hobby” blog.

Site unavailable.... again...
Site unavailable…. again…

After limiting my WordPress memory usage, I couldn’t understand how I was going over my memory allocation. I opened 2 support cases with Microsoft however after more than 20 emails back and forth, the engineer couldn’t explain what was happening and kept referring me to the pricing page for Azure.  Very frustrating, eg “ME: As I have stated 3 times now, I want to understand how the memory usage is calculated – when looking at the monitoring section for the last 7 days, the highest the MemoryWorkingSet gets to is 451.5MB. My WordPress instance is hard limited to 256MB and PHP limited to 128MB of memory. So why am I now constantly being charged for using over 1GB of memory?”.  So I gave up on Azure and went over to Amazon.

I figured I would try out their T1 Micro Instances that would cost be around $175 per year (after 12 months of being free). I certainly liked this section of their policy, it was something that Azure didn’t do:

When the Instance Uses Its Allotted Resources – We expect your application to consume only a certain amount of CPU resources in a period of time. If the application consumes more than your instance’s allotted CPU resources, we temporarily limit the instance so it operates at a low CPU level. If your instance continues to use all of its allotted resources, its performance will degrade. We will increase the time that we limit its CPU level, thus increasing the time before the instance is allowed to burst again.

I’m happy for the performance to be degraded, that doesn’t bother me since this is really just a personal blog. Through the AWS Marketplace, I order the WordPress powered by Bitnami, in the Australian data center on a t1.micro EC2 instance.

Wordpress powered by Bitnami
WordPress powered by Bitnami

After a couple of hours of configuring and migrating content, I’m now fully up and running on AWS.  So far so good.

 

Category: Geek | LEAVE A COMMENT
October 31 2014

Moving my WordPress blog to Azure

Here’s a little about my experience moving the hosting of this WordPress blog to the Azure platform.

I had been using Webcity to host this blog for many years. I would constantly receive warnings about CPU spikes from them because their solution doesn’t scale. This led to my account being suspended a number of times this year and in one week last month there were 2 x 8 hour+ unexplained  & un-communicated outages for all hosted websites – this pushed me over the edge to look at other solutions. I liked the idea of more stable infrastructure and the flexibility to scale up and down.

Webcity charged me $150AU per year. Using CPanel, I worked out that my total HTTP traffic per month averaged over the last 6 months is 6GB per month. Based on the Azure pricing calculator (http://azure.microsoft.com/en-us/pricing/calculator/), this means I should actually be saving around $30 per year by using Azure.

calc

To get started, I logged onto https://manage.windowsazure.com and associated my credit card with my existing Windows Live ID (or whatever it is called now). From there, I simply opened the Azure management website, went to Web Sites, Create a Web Site and then From Gallery:

azure1

Selected WordPress, then filled in the site details:

azure2

On the next page, accept the new Database name or create your own.

After a few minutes, the new website will appear and go into ‘Running’ status. Select the instance and click ‘Browse’:
azure3
Fill in your details, these are only temporary as you can change them later. Hit ‘Install WordPress’. After a few minutes there will be a success page.
azure4
A basic WordPress site is now up and running, you can visit the URL that you chose at the start – in my case it was http://danovich.azurewebsites.net/ .
The default option is to set up the web hosting plan as ‘Free’, however this doesn’t allow for a custom domain name (danovich.com.au).From the help page: Each plan has a mode associated with it. Different modes expose different sets of features and capabilities. Plans in the Free and Shared modes run on a shared infrastructure with sites managed by other customers. These sites will have strict quotas for resource utilization. Plans in the Basic and Standard modes run on resources that are dedicated to your sites and have fewer restrictions. Also see http://azure.microsoft.com/en-us/pricing/details/websites/To configure this, head back to the Azure management portal, select your website and click on ‘Scale’.  In my case I selected Shared, this will be enough for me for now and the beauty of Azure is that I can upgrade to a different plan easily later on if needed.

azure5

I originally planned to use a migration tool to move across the site configuration and content however I ran into multiple errors no matter which migration tool I tried:

  • All-in-One WP Migration
  • WP Clone by WP Academy
  • WordPress Move
  • WP Migrate DB
  • UpdraftPlus
  • Duplicator

I put this down to the fact that I had a very old and unsupported WordPress theme running plus 6+ years of WordPress customizations. I decided not to use the migration plugin tools and went for using the freshly installed WordPress instance on Azure, picked a new theme, added a handful of useful plugins and then used the native export and import functionality of WordPress to get the old posts across. I then used FTP to copy to uploads directory across.

azure6

I remembered that my DNS was hosted with my old web hosting provider, so I upgraded my domain registration provider account to also host by DNS. I entered my handful of A and CNAME records and waited til the next day for replication around the Internet. At the same time, I added an additional A record for migrate.danovich.com.au that pointed to the IP address provided by Azure (screenshot below) and also a CNAME for awverify.migrate.danovich.com.au  to point to awverify.migrate.danovich.azurewebsites.net for the purposes of testing before cutting over the remaining DNS records.

After waiting for replication, I went into the Azure management portal –> configuration –> domain names  –> manage domains, where I added the new line for migrate.danovich.com.au.  I could then use my browser to see that migrate.danovich.com.au was now showing my new website hosted on Azure.  The next step was to update my remaining A & CNAME DNS records to point to the IP address or the awverify CNAME that Azure needs for verification.

DNS records
DNS records
Manage custom domains
Manage custom domains

Once this was done, I could access the website using blog.danovich.com.au or any of the other DNS entries I had added.

Whilst it was very easy to set up a WordPress instance on Azure and relatively easy to import my old content, I’ve had a few issues using Azure – specifically around billing and availability –  to the point where I don’t see me continuing to use Azure in the future. I’ll save that for another post…… but overall it was a very easy process to get WordPress up and running on Azure.

October 3 2014

Huge WordPress wp_wps_logs database table

Recently while cleaning up my WordPress database, I noticed that the wp_wps_logs table was over 470MB in size. After a bit of research, I realised this was due to an old plugin that I once used – iThemes Security (formerly Better WP Security). I no longer used this so I needed to get the database size down.


Through cPanel, I opened myPhPAdmin.  On the left I navigated to the wp_wps_logs table then clicked on the Operations tab in the top right. Scrolling down to the bottom of the page, there is the option to Empty the table (TRUNCATE). Once I truncated the table, my database size was down to about 20MB!


wp_wps_logs
Category: Geek | LEAVE A COMMENT
February 15 2010

WordPress hack attack – itsallbreaksoft.net paymoneysystem.info chinaontv.com

There is a new attack on older versions of WordPress doing the rounds and my version of WordPress (2.8.9 – only just behind the current version of 2.9.1) was vunerable and was compromised.

I first noticed yesterday when all of the traffic to blog.danovich.com.au was getting redirected to www.chinaontv.com about 5 seconds after loading.

Investigations revealed that my header.php file had been hijacked, a new administrator user account had been created and there were several uploads appeared in my uploads directory.

The fixes were relatively simple and are outlined here –> http://www.theinternetpatrol.com/was-your-site-hacked-redirecting-to-itsallbreaksoftnet-or-paymoneysysteminfo-heres-what-happened/

Moral of the story – keep your software up to date – even minor point versions behind can put you at risk!

Category: Geek | LEAVE A COMMENT