Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Way of the Future

37169c5c58e9add105cda1c63584b9f3?s=47 Jason Cosper
November 07, 2015

Way of the Future

With the performance gains promised by HHVM and PHP 7, WordPress site admins are living in pretty exciting times. The PHP world at large is in a proverbial space race, and every WordPress site will (eventually) benefit. But early adopters and folks who manage their own servers shouldn’t be the only ones who get early access to these face melting bumps in speed. In this talk, I’ll be introducing you to things you can do to get your code ready for these next generation hosting environments.

37169c5c58e9add105cda1c63584b9f3?s=128

Jason Cosper

November 07, 2015
Tweet

Transcript

  1. None
  2. I'm Jason Cosper I work at WP Engine

  3. I created Hipster Ipsum I organize the Bakersfield WordPress Meetup

    I maintain the Force Strong Passwords plugin
  4. @boogah

  5. When I gave this talk five months ago...

  6. I was pushing HHVM Hard

  7. The numbers were compelling WordPress 4.1.x with 20 concurrent users.

    • Requests per second • PHP 5.5: 256 • PHP 7: 627 • HHVM 3.7: 666 • Latency • PHP 5.5: 78 milliseconds • PHP 7: 32 milliseconds • HHVM 3.7: 30 milliseconds
  8. PHP adoption rates were depressing • PHP 5.3 — 41.4%

    • Released: June 30, 2009 • End of Life: August 14, 2014 • PHP 5.4 — 30.1% • Released: March 1, 2012 • End of Life: September 12, 2015 • PHP 5.5 — 9.3% • Released: June 20, 2013 • End of Life: June 20, 2016 • PHP 5.6 — 1.5% • Released: August 28, 2014 • End of Life: August 28, 2017
  9. And hosts were announcing HHVM support • WP Engine •

    DreamHost • Pagely • SiteGround • Kinsta • Etc.
  10. Legacy PHP bad

  11. But I was being myopic

  12. Don't get me wrong HHVM is still fast

  13. None
  14. But PHP is PHP

  15. PHP 7 is PHP on steroids

  16. Let's take a look at some numbers boogah.org/55vs7

  17. PHP 5.5 vs. PHP 7 • WordPress (4.3.1) • PHP

    7 was 2.6 times faster than PHP 5.5 • WordPress (4.3.1) + WooCommerce (2.4.8) • PHP 7 was 1.4 times faster than PHP 5.5 • WordPress (4.3.1) + bbPress (2.5.8) • PHP 7 was 6.6 times faster than PHP 5.5 • WordPress (4.3.1) + BuddyPress (2.3.4) • PHP 7 was 4.7 times faster than PHP 5.5
  18. All these numbers are pretty awesome

  19. However, 67.9% of all PHP sites are currently powered by

    versions that should be considered dead
  20. They have ceased to be

  21. Why should anyone give a !?

  22. Nobody builds sites for the past You build them for

    the future
  23. The futch

  24. vagrantup.com

  25. Vagrant creates & configures virtual development environments

  26. This means less yak shaving & more working

  27. Varying Vagrant Vagrants is the industry standard for WordPress development

  28. There is another

  29. It does PHP 7 & HHVM And it was made

    for WordPress development
  30. HGV github.com/wpengine/hgv

  31. Built by WP Engine for our Mercury platform

  32. No matter where you host your site, you can use

    HGV to test your code
  33. HGV • Built with members of the 10up team •

    Work on your code under PHP 5.5, PHP 7 & HHVM at the same time • Provision multiple sites using YML files • Debugging & benchmarking tools • Xdebug • XHProf • Siege • query-monitor • debug-objects • debug-bar
  34. Installing HGV is easyish

  35. Prerequisites • Git • VirtualBox or VMware • Vagrant •

    The Vagrant Ghost plugin boogah.org/hgv-prereq ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install git brew install caskroom/cask/brew-cask brew cask install vagrant brew cask install virtualbox vagrant plugin install vagrant-ghost
  36. Install cd ~ mkdir vagrant cd vagrant git clone --recursive

    https://github.com/wpengine/hgv.git cd hgv vagrant up
  37. While HGV installs, make yourself a drink It should only

    take about 30 minutes
  38. Get to work • Local file access • Use your

    favorite text editor! • [HGV_dir]/hgv_data/sites/[sitename]/ • [HGV_dir]/hgv_data/sites/[sitename]/wp-content/[plugins|themes]/ • SSH • vagrant ssh • phpMyAdmin • admin.hgv.test/phpmyadmin/
  39. Just import your site and see what breaks

  40. PHP 7 & WordPress boogah.org/php7wp

  41. Switching your environment is a piece of cake

  42. Force your site to PHP 7 vagrant ssh sudo nano

    -w /etc/nginx/conf.d/www-[sitename].conf
  43. Force your site to PHP 7 Change this: cache.php.example.test php;

    php.example.test php; To this: cache.php.example.test php7; php.example.test php7; Save your changes!
  44. Force your site to PHP 7 service nginx restart

  45. Questions?