How to Make WooCommerce Work with PHP7, Redis, Varnish Cache, Memcached and HTTP/2

I am an internet entrepreneur and was self managing my own server for the longest time. Without knowing how to use command line, what SUDO means, or being familiar with the Linux file system, I fired up a Rackspace server configured for WordPress and WooCommerce and began my journey as an online seller.

Things were going fairly good for a while but eventually I would need better performance and caching layers to keep things snappy and profitable (more speed, more conversions). And so the nightmare began. There I was, not sure how to implement these things and spending more time learning about being a sys admin rather than increasing my sales.

I learned how to get Varnish working and it did indeed make my website much snappier. But to my demise, the cart no longer accepted products and customers who wished to pay were greeted by empty order confirmations. I set out in a frenzied search to try and salvage my effort of becoming sped up with Varnish.

My journeys took me to the forums of wordpress.org. Other WordPress patrons were also having trouble getting Varnish working with WooCommerce and the cart and checkout pages. We collaborated and tested each other’s solutions. I read up on the Varnish documentation and learned that certain cookies weren’t being excluded from the cache which resulted in customer sessions being lost. I found examples of other Varnish commands on Stack Overflow and copied one command that contained the overall structure and went from there. I cross referenced with the Varnish documentation and inferred where edits should be made and commands added to achieve the exclusion of cart and customer session cookies. I fixed issues with the VCC-compiler by trying various combinations until I discovered what caused the compiler to fail.

I was in the end capable of producing several lines of code.

First draft:

 if (req.url ~ "^/(cart|my-account|checkout|addons)") {
return (pass);
}
if ( req.url ~ "?add-to-cart=" ) {
return (pass);
}

Longer attempt:

acl purge {
"localhost";
}
include "/etc/varnish/include/example.com_.vcl";

sub vcl_recv {
set req.backend = default;
return(pass);
if (req.url ~ "^/(cart|my-account|checkout|addons)") {
return (pass);
}
if ( req.url ~ "\?add-to-cart=" ) {
return (pass);
}
}

In the end, none of this worked. Customer session cookies were still being lost and carts remained empty. I turned off Varnish and gave up, at least for the time being.

And then the reply finally came. Someone had cracked the code and managed to get Varnish fully operational and compatible with WooCommerce – including with carts, products, customer sessions and all. The code was however not directly available to us. Instead, the person who was now successfully operating a WooCommerce + Varnish server had done it using a managed cloud hosting provider. He did not have root access and hence could not directly view the code. He said he would ask the engineers at the cloud company to hopefully share their fantastic discovery with all mankind.

As the days passed, so did the silence. The cloud company had not provided details, and one of the participants in the group had himself given up and instead signed up for the managed cloud hosting provider. He reported that the Varnish and WooCommerce server did in fact work. No one knew how the engineers at the cloud company had made it, but made it they had.

This put me in a peculiar situation. I was morally opposed to fully managed cloud hosting as I believed I would not learn as much and hence have less control over the intricacies of my online business. But it was also dawning on me that if I truly wanted to become a good sys admin, I would have to forgo becoming a good online seller. I chose to go with the latter and signed up for the managed cloud hosting provider as well, dreaming of the possibilities of a Varnish-enabled WooCommerce store.

The new cloud provider had a tool that would let me migrate my entire WordPress site from RackSpace to one of their cloud servers in one click. I was highly skeptical of this given my previous experiences with bold claims. But to my surprise the store migrated perfectly. All I had to do was enter my domain name and my website was back up and running, now emboldened with Varnish directly injected into its veins. Varnish was fully working and gloriously caching away while never touching a WooCommerce customer session cookie or cart cookie ever again. I had finally accomplished what I had set out to do – making WooCommerce play ball with Varnish.

I can’t access root so I can’t tell you which settings ultimately got Varnish to work with WooCommerce. But the managed cloud hosting provider that ultimately figured it out is called Cloudways. I recommend you give them a try if WooCommerce is your bread and butter. I am using them now with great results.

Aside:

To be fair, at first I hated the fact I had been swooned over to Cloudways since it meant less control for me. I was however tired of pretending to be a sys-admin. Rackspace also required a minimum of $500 per month to get their managed service level activated, to then attempt to fix my Varnish configuration with no guarantees. The same performance for $60 at Rackspace cost $30 at Cloudways. I went up one level and got better performance than Rackspace for $75, and another perk is finally not having to dabble with the back-end anymore. I also switched because of running PHP7, and updating that on Rackspace turned out to be a pain.

 

WooCommerce pays tribute to Breaking Bad, Crystal Meth

Everybody likes Breaking Bad – the TV show on FX about Walt, the high school chemistry teacher diagnosed with cancer turned meth cook and drug baron.

As it turns out, the developers behind the shopping cart plugin for WordPress called WooCommerce likes Breaking Bad just as much as we do and are now referencing the TV show secretly in one of their product exhibition pictures.

If you are going to buy a plugin called Local Pickup Plus, this image will greet you:

WooCommerce Local Pickup PLus
The Pollos Hermanos Fry Batter was used by Walt & Fring to secretly move crystal meth across the United States.

See the item called Pollos Hermanos Fry Batter? It’s available for pickup in Albuquerque, New Mexico. That happens to be where Pollos Hermanos was located in Breaking Bad. Gustavo Fring who owned Pollos Hermanos used the Fry Batter containers to secretly move crystal meth around the United States.

You know a TV show is good if it makes it all the way into a screenshot for a WordPress shopping cart plugin.

Google Hangouts Integrates SMS, Doesn’t Violate Privacy

Our favorite privacy violator has updated Hangouts to include SMS (text) integration. According to a fierce debate, Google opted not to include SMS backups to their cloud in fear of user privacy concerns.

Google is already all over my privacy so uploading my sms’ to their cloud doesn’t bother me. The stuff they got on me through my use of Gmail and Youtube and Chrome and Search and Android and Google Docs and Google Keep and Google Plus and Google Drive does bother me.

Jira from Atlassian Sucks

Jira, the project management and bug tracking software from Atlassian SUCKS BIG TIME. It sucks so much that I had to log into my website and write this rant even though I have a thousand other more pressing things to do. Jira and it’s lack of brilliance is the most irritating piece of software I have had the misfortune of experiencing and almost not using at all since Windows 98.

I just received another pre-alpha release of my app from my developer and as you would expect from such an early-stage release it was buggy. When something is buggy you write down the bugs so they can be fixed. And this is what Jira fails so hard at doing. By the time I logged into their slow sluggish hosted solution and clicked my way through their grotesque old-world menu system and finally found that little miniscule button for reporting a bug – I had already forgotten what it was. Safe to say I resorted to the most logical thing to do at that point – I opened a Google Docs text editor and added all the bugs as bullet points with the app version number as the title (even better, I shared that doc with my developer so he gets instant updates whenever I add something. Even better again, I can add bugs from anywhere now including my phone with the Google Drive App). And that is where all my bugs will go from now on.

This is the first time I am put in front of what the industry apparently thinks is a great, useful, brilliant and overall easy-to-use “behind-the-scenes” software and boy are they wrong. If this is as good as it gets my next piece of software will be a project management and bug-tracking app that makes Jira look like the crippled mouth-breathing relic that it is.

If Jira was free this rant wouldn’t be fair. But Jira is a subscription-based $10/month extortion where you pony up the cash because you are one of the unfortunate souls that have invested in all-things 90’s such as subversion.

Enterprise software is a funny world because things like Jira and Bugzilla can exist. But that’s also a huge opportunity. Let me give you a hint: mobile software development is still a huge booming gold rush in its infancy. It is expected to be worth $25 billion dollars in 2015. More entrepreneurs than ever before will enter this booming market with limited coding ability and they will need something other than Jira. If you can create a project management and bug tracking software that is tailored for mobile app development, resides in the cloud, is accessible from anything with a screen and an internet connection, is just as easy and straight forward to use as Gmail and its related services, costs $5.99 a month and let’s a cross-functional team spend more time fixing bugs than documenting them, you might have a winner. Please put me in the credits if you do.

Update

Use Trello. It has all the features I listed above, it is free, it works on any device, it is hosted in the cloud and it is very easy to use for a smaller team.

Microsoft Sucks at Product Presentations

Screwing up a presentation is pretty easy, especially if you work for Microsoft. Just volunteer to present any of their cutting-edge products and the rest will sort itself out. Microsoft has an impressive history of embarrassing product presentations. It has become almost a tradition for each new iteration of Windows to crash on-stage to everyone else’s amusement.

The following video depicts Steven Sinofsky subjected to such humiliation. It is funny because he sticks to the script even after the tablet has broken down.

And then there’s Bill Gates. This video depicts a classic BSOD (Blue Screen of Death) on stage. These were the rule and not the exception in the early days of Windows (and Microsoft).

The iPhone 5 is the Beginning of the End of Apple

And so it begins. Apple post Jobs is not what it used to be, and I knew it would happen sooner or later.The new iPhone 5 is not that groundbreaking and it feels like just about any other new smartphone: high-tech yes, groundbreaking not so much. The problem with companies like Apple is the visionary-type leader. Once he is gone, no one can really replace him. And then there is the keynote. Steve Jobs would cook up (no pun intended) all kinds of strange innovations and sometimes it was hard for us to see why they would work. Take the iPad: it looked like a big iPhone but Steve convinced us iPads make sense. And now they do.

There is nothing for Samsung to copy now that iPhone has nothing new to revolutionize

– Kumar Indresh

The iPhone 5 keynote by Tim Cook on the other hand felt like any other tech product launch. And the upgrades don’t make sense. It could be that Jobs is not around to tell us why a longer iPhone is better, or it could be because he didn’t design it in the first place. If you own Apple stock, I would contemplate a sale pretty soon. If you don’t, I would contemplate a short-sale pretty soon.

Sour Times as Houses Seized by Banks

You know things are bad when you measure the performance of the economy in the rate of houses seized by banks. Nevertheless, in these sour times it is a good indicator of how screwed we really are. There should be a how-screwed-we-are index for this.

Reuters reports that the rate has slightly gone down which is good news and might shed some hope on the future of America.

We should probably also spend a minute thinking about why people buy houses they can’t afford. But let’s not rub salt into the wound at this point.

Innocence of Muslims vs. Life of Brian

I have written a lot today about censorship and politics. But this news story caught my eye. The U.S. ambassador Christopher Stephens was killed in Libya because a guy posted a video on YouTube making fun of the Muslim prophet Mohammed. If you have seen the movie Life of Brian you know the drill: a religious figure is being made fun of on the expense of everyone else. But what struck me here was the reaction. Killing the ambassador, really?

Below is a clip of the movie Life of Brian. The notorious YouTube trailer for the movie Innocence of Muslims follows after.

Below is the Innocence of Muslims trailer. Can you see the connection? 

Google Censors the Pirate Bay

Google’s slogan is do no evil. After reading the latest headlines about Google’s decision to censor The Pirate Bay in its auto-complete results it had me wondering if it’s time to abandon ship. It’s not the first time Google censors things – they have censored many piracy-related search terms over the past to pull their weight in the war against online piracy. But what are the implications?

If you are cataloging the web, should you really tamper with the results? When you grow big and powerful enough things eventually start to change, even if you are do-no-evil-Google. They are no longer a simple cataloger of the web but a massive multinational corporation employing thousands of people in over 30 countries and hundreds of cities around the world. Their catalog has grown so big and influential that they feel inclined to employ a moral compass to guide people in what they believe to be the right direction.

And this is where Google stumbles down the slippery slope of loosing touch with its humble beginnings. Google no longer feels like the online unbiased buddy you could turn to with any question whenever you needed help with finding your way digitally. Maybe DuckDuckGo will serve us better with its privacy and anonymity.