I just rolled out a new site on my server that is running a store with WooCommerce. Because woo is heavy, I am also trying out HHVM on this site for the first time to try to increase performance. I used the tutorial here: https://rtcamp.com/tutorials/php/hhvm-with-fpm-fallback/ to get started and mostly things were working fine. I found that there is a conflict between W3tc and HHVM. It’s a known issue ( https://wordpress.org/support/topic/warning-with-hhvm ). I turned off W3tc and found the site was running faster without it anyway.
Mostly everything worked fine under HHVM, but I did run into one issue during checkout. I don’t know if this is peculiar to the paypal pro payment gateway that my client uses, or if it is a more general problem, but when a customer tried to checkout, HHVM threw a 500 error and the checkout process just hung up and never completed.
I worked around it by falling back to php-fpm just for the checkout. Here’s how I did that with the nginx conf for the site:
# can't currently use hhvm for cart checkout
set $backend hhvm;
if ($query_string ~ "action=woocommerce_checkout") {
set $backend php;
}
location ~ \.php$ {
set $rt_session "";
if ($http_cookie ~* "wp_woocommerce_session_[^=]*=([^%]+)%7C") {
set $rt_session wp_woocommerce_session_$1;
}
if ($skip_cache = 0 ) {
more_clear_headers "Set-Cookie*";
set $rt_session "";
}
fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";
try_files $uri =404;
include fastcgi_params;
fastcgi_pass $backend;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
}
note the fastcgi_pass $backend;
in the location block. This uses the variable set before the location block to run just the checkout ajax request via the php-fpm back end.
to go with that, here is my upstream.conf modified from the version presented in the rtcamp hhvm tutorial:
# Common upstream settings
upstream php {
# server unix:/run/php5-fpm.sock;
server 127.0.0.1:9000;
}
upstream hhvm {
server 127.0.0.1:8000;
server 127.0.0.1:9000 backup;
}
upstream debug {
# Debug Pool
server 127.0.0.1:9001;
}