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

Jump the Windows 10 Hurdles and Run WP-CLI to Install Local WordPress Development Sites

AmyEtcetera
December 10, 2018

Jump the Windows 10 Hurdles and Run WP-CLI to Install Local WordPress Development Sites

Here's a quick recipe to try out WP-CLI on Windows, for command line installation and admin of local WordPress development sites. Don't let the setup throw you--it can take a bit of patience to find where PHP and MySQL are installed within WAMP and get the environment variables edited.

Notes:
1) I'm not an expert in this, and am not presenting this method as a best practice -- still learning! The message is: if you can read and follow directions, stick with it and you can do this (or similar small adventures) yourself.
2) Try to have your MySQL running an updated version, unlike this example!
3) Good luck!

AmyEtcetera

December 10, 2018
Tweet

More Decks by AmyEtcetera

Other Decks in Technology

Transcript

  1. Jump the Windows 10 Hurdles & Run WP-CLI to Install

    Local WordPress Development Sites (You got this!)
  2. Steps First steps: Modify Windows environment Download .phar file Create

    .bat file From command line: Download WordPress Create config file Install database Install WordPress Install and activate plugin
  3. Add PHP and MySql to Path Control Panel > System

    and Security > System > Advanced System Settings > Environment Variables [click button]
  4. System Variables: PHP Locate System variables pane (the lower one).

    Scroll to Path entry. Double click it. Enter the PHP directory's path at the end of list by clicking the New button and pasting in the path. Ex: C:\wamp64\bin\php\php7.0.10
  5. System Variables: MySQL Do the same for MySQL, pasting in

    the path on a new line. ex: C:\wamp64\bin\mysql\mysql5.7.14\bin Be sure to click OK on each window.
  6. It is a phar phar better thing I do... Download

    wp-cli.phar from make.wordpress site or https://wp-cli.org/. Save it to a folder: C:\wp-cli
  7. Add to the .bat file: @ECHO OFF php "c:/wp-cli/wp-cli.phar" %*

    (Notice this matches the path to the wp-cli file.) Save and close.
  8. wp --info Type wp --info to see info about this

    install. (The OS, shell being used (cmd.exe), PHP path and version, WP-CLI path and version should appear.)
  9. Variables not global. BUT if you open Command Prompt elsewhere

    in system and type in wp, the command is not recognized.
  10. Let's fix that...one more tweak. Control Panel > System and

    Security > System > Advanced System Settings Click "Environment Variables..." button. Look at User Variables pane (section at the top).
  11. Modifying User Variables / Path Double click on Path. Click

    New. Paste in the path to wp-cli, which is C:\wp-cli Click OK on each open window from that process.
  12. Create folder for WordPress. Back to the command line, navigate

    to C:\wamp64\www Create folder for the site: > mkdir wpfiveo (or call it wordpress, whatever)
  13. Success! You should see: "Downloading WordPress 5.0 (en_US)..." then "md5

    has verified: [long string]" "Success: WordPress downloaded."
  14. Create config file. > wp core config --prompt and you

    only have to fill in the first two: (type what you want and press enter) 1/12 --dbname=<dbname>: fiveo 2/12 --dbuser=<dbuser>: root [press enter to skip subsequent prompts]
  15. Install and activate plugin - find slug "Health Check &

    Troubleshooting" Find the slug and not the name. You may want to visit the web page and look at the URL.