Develop from Localhost using WordPress.

Introduction(Catching Back up & Real Talk):

**You can skip this section if you want to get straight to learning**

The past couple months have been super busy from starting my 16th website at Titan Web Marketing Solutions to learning from Wes Bos’ new Node.js video tutorial on the weekends and early mornings.  I haven’t had much time to devote to blogging, so this post is long overdue. It’s actually 4:39 am right now. haha. So I actually still don’t have time in my day to blog, but it’s that important that I’m “making” the time to do this. My days seem to feel like there are fewer hours in the day then I can cram in them. Amongst work and learning, I still find time to spend with my family and being involved in church every Saturday. I wake up early every day and make coffee for my wife, so she knows that she is still most important in my life. I believe having that healthy balance is crucial to maintaining a consistency for high productivity. If my family or church is out of wack… meaning I’m not giving them enough attention… it overflows into my work. I can’t focus when there are major issues at home. That is why I strive to take care of home life first and foremost. It’s not what you do that matters, but why you do it. Every day when I wake up, I feel completely blessed when I see my wife and son still resting. Anything of value requires work, and I believe that the effort I put into my work should be the same effort I put into my family.

On to Localhost Environment:

*Sidenote: this is not the only setup for developing locally. There are many many other avenues, but I have found this one to be the most productive and suitable for my needs. And here is why once installation is complete, it takes only a matter of seconds to create a newWordPresss site. You can get up and running with zero downtime. Less time setting up, and more time developing great websites.

Here is a list of everything I use to work within a localhost environment:

– Requirements – (Total time for installs could take a couple hours for a junior dev)

  • Composer
  • Homebrew
  • PHP
  • Laravel Valet
  • WP-CLI.org
  • Valet Park
  • Sequel Pro

Here is how to install each item on this list:

Composer Install

– open up your Terminal or iTerm

– type “PHP -v” to verify you have the latest PHP version installed

– next, we need to download Composer:

– go to your browser and type link

getcomposer.org/download

– read the tutorial to know what to copy and paste the into the terminal

*hint= it should be inside a box that says run this in your terminal*

-now we need to move that file to make it globally accessible.

– type “mv composer.phar /usr/local/bin/composer”

– if that doesn’t work

-type “Sudo mv composer.phar /usr/local/bin/composer”

-it will ask for a password. fill in and hit enter

– type “composer -V” to verify that you installed composer correctly

 

Homebrew Install

– open up your Terminal or iTerm

– copy and paste into terminal /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

– or go to brew.sh copy and paste that link

-type password if prompt

-type “brew update” to make sure you have the latest version

Valet & PHP Install

  • open up your Terminal or iTerm
  • type “brew update” for the latest homebrew version
  • install PHP 7.1
  • type “brew install homebrew/PHP/php71”
  • next, install Valet with composer
  • type “composer global require laravel/valet”
  • type “export PATH=$PATH:~/.composer/vendor/bin >> ~/.zshrc
  • it may ask for a password. fill that in now
  • next type “valet install” this will configure and install valet and DnsMasq, and register Valet’s Daemon to launch when your system starts.
  • Type “ping foobar.dev”
  • If valet installed correctly you should be able to see the domain responding.
  • To exit, hold “control + C” and it will exit the ping
  • Next type “brew install MySQL”
  • Next type “brew services list” to see if MySQL is running
  • Next type “brew services start MySQL”
  • Type “brew services list” again to make sure it is running

Valet Park Install

  • open up your Terminal or iTerm
  • type “mkdir Sites” hit enter
  • type “cd Sites” hit enter
  • type “valet park”
  • this command will register your current working directory as a path that Valet should search for sites
  • to get your server running just type “Valet start” in the terminal

WP-CLI Install

– open up your Terminal or iTerm

– type “brew install homebrew/PHP/wp-CLI”

– type password if prompt

– next copy and paste: “PHP wp-CLI.phar –info”

– this will help verify that you installed it correctly

– next, if valet park is installed

– type “cd Sites”

– type “wp core download –path=newfilename”

– if wp-CLI is installed it should download WordPress.

  • now you still aren’t finished. You need a database(sequel pro) installed/setup and make you start your server from the terminal by typing “valet start”.

**Do this install last**

Sequel Pro Install

  • go to sequelpro.com
  • click download
  • once it’s finished, click to open the folder
  • open a new window in Finder
  • click on the applications tab
  • drag sequel pro application to applications folder
  • double click sequel pro to open
  • click “open” button on the notification
  • this will bring you to sequel pro homepage
  • click on “Socket” tab
  • for username type “root”
  • for password leave empty
  • click “Add to Favorites”
  • click “Connect”
  • click “users” at top right
  • click “+” at the bottom left
  • type in your new username
  • type in your new password
  • save this information in excel sheet online
  • click “Global Privileges” tab
  • click “Check All” and hit “Apply” button

Development

– open iTerm or Terminal

– verify you are in root “~” directory

– type “cd Sites” hit enter

– type “wp core download –path=FILENAME”

it should look like this.

“wp core download –path=FILENAME” hit enter

Your new WordPress site is now downloaded into your new folder

– open browser

– in browser, type “FILENAME.dev” hit enter

– you should see WordPress admin setup-config page

– leave a browser open

– hold “command” key and press “space bar”

– type “sequel pro” hit enter

– verify you are on “socket” tab

– verify username: root

– verify password: empty

– click “connect” button

– hold option + shift and hit “A”

– type in the name of your NEW temp database

   Your new site is ready to begin development, Now add a user

– at the top right, click users

– at the bottom left, click “+” to add a user

– type in username & password.

– click “Global Privileges” tab

– click “Check All”

– click “Apply” to save username and password

– copy and paste username and password on excel sheet online

– go back to the browser and finish setting up your WordPress site

 

-until next time

Shaun Willis

p.s. if you have any trouble setting this up, please leave a comment below.

 

One thought on “Develop from Localhost using WordPress.

  1. Hey Shaun, thanks for providing this.

    Under the “WP-CLI Install” section, to verify installation of WP-CLI, the line should read “php wp-cli.phar –info”. I believe you’re missing a dash in that line, just before the word “info”, as per the wp-cli.org docs.

    Like

Leave a comment