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

Way of the Future

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.

Jason Cosper

November 07, 2015
Tweet

More Decks by Jason Cosper

Other Decks in Technology

Transcript

  1. View Slide

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

    View Slide

  3. I created Hipster Ipsum
    I organize the Bakersfield WordPress Meetup
    I maintain the Force Strong Passwords plugin

    View Slide

  4. @boogah

    View Slide

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

    View Slide

  6. I was pushing HHVM
    Hard

    View Slide

  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

    View Slide

  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

    View Slide

  9. And hosts were announcing HHVM support
    • WP Engine
    • DreamHost
    • Pagely
    • SiteGround
    • Kinsta
    • Etc.

    View Slide

  10. Legacy PHP bad

    View Slide

  11. But I was being myopic

    View Slide

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

    View Slide

  13. View Slide

  14. But PHP is PHP

    View Slide

  15. PHP 7 is PHP
    on steroids

    View Slide

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

    View Slide

  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

    View Slide

  18. All these numbers are
    pretty awesome

    View Slide

  19. However, 67.9% of all PHP sites
    are currently powered by versions
    that should be considered dead

    View Slide

  20. They have ceased to be

    View Slide

  21. Why should anyone give a !?

    View Slide

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

    View Slide

  23. The futch

    View Slide

  24. vagrantup.com

    View Slide

  25. Vagrant creates & configures
    virtual development environments

    View Slide

  26. This means
    less yak shaving & more working

    View Slide

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

    View Slide

  28. There is another

    View Slide

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

    View Slide

  30. HGV
    github.com/wpengine/hgv

    View Slide

  31. Built by WP Engine
    for our Mercury platform

    View Slide

  32. No matter where you host your site,
    you can use HGV to test your code

    View Slide

  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

    View Slide

  34. Installing HGV is easyish

    View Slide

  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

    View Slide

  36. Install
    cd ~
    mkdir vagrant
    cd vagrant
    git clone --recursive https://github.com/wpengine/hgv.git
    cd hgv
    vagrant up

    View Slide

  37. While HGV installs, make yourself a drink
    It should only take about 30 minutes

    View Slide

  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/

    View Slide

  39. Just import your site
    and see what breaks

    View Slide

  40. PHP 7 & WordPress
    boogah.org/php7wp

    View Slide

  41. Switching your environment
    is a piece of cake

    View Slide

  42. Force your site to PHP 7
    vagrant ssh
    sudo nano -w /etc/nginx/conf.d/www-[sitename].conf

    View Slide

  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!

    View Slide

  44. Force your site to PHP 7
    service nginx restart

    View Slide

  45. Questions?

    View Slide