Quick WordPress Dev Setup

by Scott, Revised on March 29, 2019 (PHPMySQLWordPress)

Since my future may depend on it, I have decided to dive in deeper. While I can get around WordPress well enough, and have made at least one template from scratch, I am sure I did not do it right. I also want to come up with the easiest dev setup possible and take notes while I do it.

My dev systems are on Kubuntu desktops, so all Ubuntu sources work fine.

MySQL

sudo apt install mysql-server

Since MySQL 5.7 uses the auth_socket plugin for authentication, I have found notes describing how to change the authentication back to a password. However, since it seems more like what I am use to with PostgreSQL, I will leave it as is. I am not going for great security on my personal dev machines, just easiest for me.

sudo mysql
mysql> create user 'me'@'localhost';
mysql> grant all privileges on *.* to 'me'@'localhost' with grant option;
mysql> update mysql.user set plugin = 'auth_socket' where user = 'me';
mysql> flush privileges;

PHP

I just apt install the most recent PHP packages (including the cli package). I like to use the built-in PHP dev server. I am used to using dev servers rather than setting up web servers. I make a bash script to start a server.

#!/bin/sh
port="${1:-8000}"
php -S 127.0.0.1:"$port"

phpMyAdmin

Because I have set up my systems login user as a DB user with full privileges, and the PHP runs as the same user, I just unzip the phpMyAdmin, cd into the directory, run the PHP dev server and then open 127.0.0.1:8000 in my browser and the auth_socket allows all to work as needed.

WordPress

Create a user and a database.

mysql> create user 'appuser'@'localhost' identified by 'reallytuff';
mysql> create database wpdb;
mysql> grant all on wpdb.* to 'appuser'@'localhost';
mysql> flush privileges;

Unzip and cd into directory. Edit the wp-config-sample.php and save as wp-config.php. Cd into directory and run another PHP dev server. Open in browser and follow the instructions.

Tags: PHPMySQLWordPress