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.

Google is Spying on Us

Google Keep is cool because it has search. However, they should let you share cards so that individual cards can become visible to several people. A Public checklist for example, or instructions to give someone. They should be editable by participants or locked but visible. I think it could work and it teaches Google what type of topics or interests similar groups of people share and consequently lets Google build a better relationship map in their database. Gotta make sure Google gets their share too.

When Software Piracy is OK

Software piracy is bad in most cases, especially when it involves frivolously indulging in all kinds of loot found on The Pirate Bay for the sake of simple entertainment. But what about the first-time entrepreneur who self-teaches a pirated copy of Photoshop to make a logo for her first website? Or the YouTube poster who tries his hands on professional video editing software to make his videos look better? These people might also be pirates but their impact on the organizations they pirate from is negligible at worst and beneficial at best.

They Weren’t Expected Customers

The software put out by giants like Adobe is made for a professional crowd and priced thereafter. Their customers rely on their software to make a living; buying it is an investment rather than an expense. What Adobe isn’t relying on is selling a few extra copies of its software to curious teenagers or people looking for an alternative to Windows Paint. Software piracy is only a problem if it hurts sales. Everything else is just free marketing. If {insert big company} wasn’t expecting you to buy their product (because you aren’t their customer and can’t afford it in the first place) it doesn’t hurt them. If you are using Adobe Illustrator to make squiggly graphics on your spare time you aren’t hurting Adobe’s bottom line because you would have never been a paying customer.

They Provide Free Marketing

Having people all over the world using your software without hurting your bottom line sounds like an ideal marketing campaign, and it is. Droves of people start learning your software, their peers will take up interest and you receive free brand awareness. All this knowledge and goodwill towards your company will be paid back when these people become professionals and purchase your software for their business needs. Don’t look at it as piracy, look at it as early adoption. Or even freemium.

They Become Future Customers

People who grow up around renowned pirated software products tend to stick with them in the future as well. A skilled teenage Photoshop hobbyist might turn into a graphic designer after a few years who subsequently starts a company. Companies can’t afford to risk it with pirated software and will invest in the real deal. Plus, paying for software that actually lets you earn revenue doesn’t feel like a waste of money. It feels like (and is) an investment.

Freemium is Legal Piracy

Legal piracy already exists. It’s called freemium. This model builds on everything explained above and lets the professionals pay for premium services, lets the noobs play around without risking fines or imprisonment and most importantly lets the fledgling entrepreneurs start out with minimal investment and grow with the software.

If anything, piracy is the result of incompatible world views and freemium has addressed that. Rather than making software one-size-fits-all it can now be handed out in bite-sized portions. Sample, eat one item or order the whole menu. Its fair, its modern and its here to stay.

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.