Saturday, October 6, 2018

Migrating a live WordPress site to XAMPP localhost

This guide assumes you have some basic knowledge about XAMPP, phpMyAdmin, and MySQL and have done this process before, but maybe not in a long time. If you need a more detailed step-by-step guide, you'll have to look elsewhere.

Step 1: Installing XAMPP

Install the specific version of XAMPP you need. For instance, I needed PHP 7.2.7 because I wanted my local environment to match my live DreamHost environment exactly. Here are their currently supported PHP versions.

Next download a fresh copy of WordPress or download your entire WordPress install from live. I opted for a fresh copy because I have lots of extra files and plugins I didn't want to waste time downloading, but this makes it slightly harder.

Export your live site database from phpMyAdmin (the quick SQL export option worked fine for me).

Navigate to c:\xampp\htdocs and setup your WordPress folder. Unzip your WordPress files or install into this folder. Here is an example of how it should look:

  • c:\xampp\htdocs\mywebsite\wp-admin
  • c:\xampp\htdocs\mywebsite\wp-content
  • c:\xampp\htdocs\mywebsite\wp-includes
If you opted for a fresh install, I would copy over your theme files. You may also need to grab your uploads folder and any required plugins or mu-plugins. For example, a few of my sites require Advanced Custom Fields to function. I copied that plugin over but not others like Sucuri or Google Analytics because those aren't required on the dev site.

You can also rename wp-config-sample.php in the root directory to wp-config.php at this point.

Step 2: Configuring phpMyAdmin and MySQL

XAMPP is accessible by typing localhost in your browser once Apache and MySQL are running. By default, phpMyAdmin and MySQL won't have passwords set, but WordPress requires those values in the wp-config.php file.

First thing you'll need to do is open the XAMPP Control Panel and click "Shell". This will open a command prompt where you can type:

  • mysqladmin.exe -u root password yourpassword
Next you'll edit c:\xampp\phpMyAdmin\config.inc.php and change the ['authtype'] value from 'config' to 'cookie'.

You can optionally change the ['blowfish_secret'] at the top to a long randomized string to stop phpMyAdmin from throwing a security warning.

Restart Apache and MySQL from the XAMPP Control Panel and navigate to: localhost/phpmyadmin

You should be met with a login screen where you can type in "root" for the username and the password you created earlier. Assuming all went smoothly, you should have access to phpMyAdmin with a valid login now.

Before jumping back to WordPress, we need to import the database. If you're not at the home area (aka you clicked a database), click the little Home icon or the "Server: 127.0.0.1" breadcrumb and then databases. Create your new database.

Notes: the database name does NOT need to match your live site database name. phpMyAdmin may also be defaulting your character set and collation to latin1_swedish_ci which doesn't match my live site settings. If this is the case for you, you can simply switch it to something like utf8_general_ci or change some config settings to default it to this value every time. This was valuable for me because I was importing 6 websites with plans to create a few more. Head over to c:\xampp\mysql\bin\my.ini and anywhere under the [mysqld] section add:
  • character-set-server=utf8
  • collation-server=utf8_general_ci
Save and restart Apache and MySQL.

Once your database is created, click on it, and then click on Import. Choose the SQL file from earlier and import the database. You may need to alter the settings, but I was able to leave all the default settings without any problems. Remember, if it doesn't work, you can always just drop the tables and start over.
  • If you database is over 2 mb you may not be able to import it by default. Open c:\xampp\php\php.ini and find "upload_max_filesize=". Change the 2M value to something like 32M or whatever value seems reasonable to you. Save, restart Apache and MySQL, and then retry the import.
The last step before configuring WordPress is to update the _options table. Usually siteurl and home are the first two rows, but you may need to search for them. They will be set to: https://www.yourwebsite.com/ which won't work for a local dev site. Edit each of those records and change the values to: http://localhost/folderName. folderName corresponds to the folder in htdocs and notice the removal of https with http.

Step 3: Setting up WordPress

Alright, now it's time to configure WordPress. Open the wp-config.php file from earlier.

Change DB_NAME to match your local database name and DB_PASSWORD to match your MySQL password from earlier. DB_USER, DB_HOST, DB_CHARSET, and DB_COLLATE should work as-is unless you changed them in a step outside of this guide.

You may also need to scroll down and change $table_prefix  = 'wp_;' to something else. For instance, DreamHost automatically changes table prefixes for WordPress installs to something like: wp_r4nd0mh45h_tablename. If your host does this, you'll need to copy over wp_r4nd0mh45h_ to this variable in the config file (notice the trailing underscore that's included).

That's it! Now when you visit localhost/folderName your WordPress site should skip the install process and load up a copy of your live site.

If it doesn't, unfortunately it could be lots of different issues you'll need to diagnose separately. However, this guide should get you 99% of the way there. Here are a few common issues that are easy to fix though:

  1. You typed in something wrong. Double check the config files and ensure everything matches EXACTLY (aka everything is case sensitive).
  2. You're missing plugins or other required files. Read any error messages to see if they tell you what's missing and check your browsers Inspector -> Console for additional details.
  3. The site loads but pages are broken. Login to wp-admin and open Settings -> Permalinks. Don't change any values and simply Save this screen. It will flush all the existing permalinks and will often magically fix broken pages!
  4. Pages are linking badly. You may need to run a search-and-replace on https://www.mywebsite.com/ and replace it with http://localhost/folderName/ to fix all the broken links.
  5. Logins, passwords, or other changes aren't working. Remember to periodically stop and restart Apache and MySQL in case a config file was changed, but not reloaded.
Good luck! If I missed anything obvious, please let me know in the comments and I'll update the guide. Thanks!

Friday, February 7, 2014

SJC Media and personal update

It's been awhile since I've posted here but recently I've felt the itch to diversify and re-target my blogging approach across multiple sites with different topics of interest. For instance, I will publishing some content over at Tumblr, some at WordPress.com, and some here at Blogger. Everything will be unique and carry different...angles of the same sort of content. So basically spawnroom.com and notdef.com will hold my legit, professional posts while these blogging services will carry things like the #NotDef Field Notes and TSR video updates, etc.

As for SJC Media LLC, my small web studio "start up" in Wisconsin, business is slowly picking up. I have a feeling there's a decent amount of competition around here, but I have the fortunate benefit of partnering with two dedicated and intelligent individuals who are handling sales, marketing, billing, and other managerial efforts while I focus almost entirely on development. It's a pretty sweet gig and I'm looking forward to my professional relationship with both of them. On the side, I still handle personal projects I receive direct from random clients around the region, but the bulk of my work comes from this partnership. I'd definitely recommend any young developers who are interested in entrepreneurship to consider partnering right out the gates of graduation. It's a great way to boost the amount of work you can find. And don't underestimate Craigslist, that's how I made my connection and found my first few clients!

Lastly, I'd just like to mention that I still work on video content over at the TSR YouTube channel, NotDef channel, and personal "perlox" YouTube channel. Although please don't judge my professional side by the content you see therein... :P

Wednesday, April 3, 2013

This Blog and Nothing Definitive

Yesterday I purchased hosting for the Nothing Definitive Series and will be separating that content from this blog. You can find the new site here, which is, and will continue, to be full of philosophical insights, enlightenment material, inspirational videos, self improvement techniques, and more. I think separating that content from business and programming insights is probably a good idea. :P

So from now on, this blog will be dedicated to business insights, code and programming lessons, entrepreneurial advice, social networking tips and tricks, how to's and tutorials, improving SEO, etc. Be sure to check out both websites and subscribe/follow each of them!

Monday, February 25, 2013

Wausau Area Bulletin Boards

I did a Google search for "wausau bulletin boards" hoping to find a listing of different places you could post flyers but nothing came up. So a friend and I decided to begin trekking around looking for potential advertising spots that are open to posting. Here is a map of the ones we've found so far:

Updated as of 25 February 2013


View Bulletin Boards in a larger map

Remember to ask permission before posting and bring your own tacks / push pins.

Thursday, February 7, 2013

Wausau Area Web Design, SJC Media LLC

Last year I registered a company called SJC Media LLC in Wisconsin. I didn't use it. Instead I worked on personal programming projects and video content. But now in 2013, I've decided to begin pursuing freelance website design and development for the central Wisconsin area (Wausau, Merrill, Rib Mountain, Stevens Point, etc.). That way I will be able to continue blogging, producing YouTube content, researching, and studying, while making some money on the side. I also hope that I can make enough to cover some purchases I've been wanting to make, like tuning up my truck (which hasn't been sounding so hot), buying a dog (I want to test my dog training skills), and getting some office supplies (I definitely need a new chair). And so, a couple weeks ago I reworked the website, prepared some things, and have begun looking for clients.

This is where the quick advertisement comes in: ladies and gentlemen, business folk, and hobbyists. Are you in need of a new website? Updating or maintenance to an existing or old one? Need general computer advice or consultation? I offer a wide variety of services to the Central Wisconsin area with expertise lying in web design, content management systems, PHP, and MVC framework development! Whatever your needs, we can work out a reasonable contract that will leave you with a project you'll be proud to share with friends, family, and clients. Just head over to sjcmediallc.com and see what we can offer you.

Ok, that's long enough. If you're interested in quick, efficient, and beautiful web design, check me out. And if you know anyone else interested, send them my way. Thanks!

Lastly, I wanted to mention some tools I've been using to setup shop. I've spent the last couple days working on SEO and social networking and love this website: Woorank. Such a great tool for quickly analyzing your websites. I also, as I've mentioned before, use Astrid and Google Documents to help organize and track tasks, client information, and reminders. Always remember to take thorough notes. Finally, services like box.com, dropbox, and Google Drive are also really handy for backing up files. I have all 3 running and upload to them regularly. That way you can adequately protect your work.

I'll keep this document updated with random tips and tools I find for helping with web development. Until then, cheers!

Thursday, January 24, 2013

Hydroponics Report #1

Note: this post will be updated periodically as new information is gathered.

Recently I became interested in hydroponics as a potential source for growing fresh vegetables for myself. The designs for an at-home system look interesting, and according to multiple sources you gain higher yields, more nutritious vegetables, and leave less of a footprint than soil-based agriculture. I also love being around nature and find it very calming. So I've begun research into the field and wanted to present what I've found thus far.

Hydroponic Systems


There are two Instructables I liked. The first is fairly simple and would probably work best for small plants. The second is more complex, but could also support larger plants and would probably have higher yields and potential for a more "commercialized" operation. The estimated cost can be found in this spreadsheet I created for the supplies (price estimates as of January 2013). Of course one could easily reduce the cost by purchasing less of the supplies, building a more basic structure, and eliminating some of the complicated wiring steps. But I would estimate these setups to cost between $200 and $250.
Note: in the first Instructable, he claims to have built his setup for around $30, but I don't see how that's possible unless you already had some of the supplies. At the absolute bare minimum, after setup, seeds/plants, etc. it's probably going to be over $100, but even then, you're probably going to have to make changes/additions which will eventually raise the cost.

What To Grow


Alright, so after you've taken a look at those setups and understand what it is I'm doing here, what about plants? I looked at various articles about which crops to grow, but most would only say a 3-4 plants at a time without revealing a nice comprehensive list. Why? Who knows. So I'll do it, here are all the plants I could find listed that people have grown Hydroponically.

Vegetables
  • Lettuce / salad greens
  • Chervil
  • Endive
  • Collard
  • Mustard greens
  • Kale
  • Arugula
  • Celery
  • Cabbage
  • Broccoli
  • Beans
  • Peas
  • Cucumbers
  • Peppers (colored, bell, hot, chili, etc.)
  • Corn
    • Warning: these take up a lot of space and need special care/consideration.

Root Vegetables
  • Turnips
  • Radishes
  • Onions (bulb)
  • Spring Onions (scallions, green onions)
  • Potatos
  • Carrots
  • Yams
  • Beets
  • Parsnips

Herbs
  • Pepper plants
  • Thyme
  • Basil
  • Oregano
  • Parsley
  • Sweet marjoram
  • Dill
  • Sage
  • Rosemary
  • Cilantro
  • Tarragon
  • Mint

Fruits
  • Tomatoes
    • Apparently these respond especially well to Hydroponics.
  • Eggplants
  • Strawberries
  • Melons, zucchini and squash
    • Warning: these take up a lot of space and need special care/consideration.

Flowers
  • Yarrow
  • Lilies
  • Tulips
  • Carnations
  • Orchids
  • Roses

Trees
  • Banana trees

Some Basics


Lastly, let's talk about some basic tips and other information you should know before jumping into Hydroponics.
  • Mixing plants in the same nutrient water can yield varying results since certain plants need different nutrients.
    • It's probably best at some point to dedicate a tub per plant type.
  • Refresh your water/nutrient mixture at least every 2 weeks since it can become toxic.
    • Storage bins / containers should be opaque since light can damage roots and cause harmful algae to grow.
    • Be sure to maintain the water level which can deplete quickly. One solution I found said that if you're going to be gone for a few days, try dangling a string or wick that can soak up water deep in solution. That way liquids will still try to reach the plant if the water level drops.
  • Be cautious about introducing foreign substances into your growing area since waterborne diseases can easily kill your plants.
    • Sterilize tools, tubs, and other items that come into contact with the system.
    • Regularly check on your system to make sure the plants look healthy and there are no visible bacteria growths.
  • Hydroponics works well because the plants can focus all its energy on growing fruits/flowers/leaves, rather than roots to find water. This results in higher yields and better tasting plants.
    • Additionally, soil doesn't allow for proper aeration and may lack important nutrients that Hydroponic systems deliver continuously.
  • The growing medium used in these systems are simply there to support the plant and allow liquids to flow through them. Make sure the medium you buy is pH neutral and clean.
    • This site had some good information regarding different mediums.
  • Some plants may be better suited to Aeroponics like root vegetables which grow down.

Friday, July 27, 2012

2012 Olympics - discovering content and live streams

List of Active Live Streams

LIVE STREAM #1
LIVE STREAM #2
LIVE STREAM #3
LIVE STREAM #4
LIVE STREAM #5

UPDATE: nice, looks like people are putting together playlists for the music used during the opening ceremony! Link 1 (YouTube) Link 2 (Spotify)

UPDATE: VIPBox live coverage center

UPDATE: if you need to find out where a shortened link goes (ex. bit.ly, j.mp, t.co, etc.) enter it at LongURL and then copy the Long URL to Site Advisor and click "View Report". That should hopefully tell you if it's safe to click.

I'm pretty excited to watch some of the games these next weeks so I thought I'd share some of the resources I've discovered to follow along and watch online. Especially since I'm one of those poor blokes that can't afford a cable package. Actually it seems weird to me that a significant world event like this isn't simply streamed online from the organization itself or some other benevolent entity...greedy bastards! :P

Anyway, below you'll find official resources for results and coverage, along with methods for discovering "other" ways of watching it online.

My preferred method of discovering content is through Twitter. Head over to twitter.com/search (you may need to login) and do a query of Tweets, for example:
Be sure to click "All" to reveal normal peoples' Tweets as well, but beware that some individuals might exploit this by submitting malware links. Use your best judgement!

You can also try advanced Google searches like this one:
That way you may discover websites that have updated with new links and fresh content.

If you're just looking for results and coverage then try some of these links:
It also appears that some countries might get free streaming services from certain websites like this one:
It may be possible to access this stream from non-applicable countries (like the US) using TOR or a proxy that masks your IP.

I'll keep this blog post updated as I find new content.