
Migrating Wordpress to Google App Engine - Configuring Your Environment
- Written by John
- Mar 1st, 2019
Before we get started with the migration, we need to look at setting up our Windows environment. A bit of preparation goes a long way. We’ll need to set up a folder location for all of our files and install utilities to enable the migration.
Caveats
Before we start I want to note a few caveats.
- My Windows environment is a host on another PC. I am running Windows 7 Pro with the latest updates, installed as of 24/02/2019.
- Throughout this series, I will be referring to the home directory as ‘~’. On Windows, this will be your C:\Users*{USERNAME}* directory.
Prerequisites
Folder Structure
I will be creating my folder structure in *~\Documents\wordpress*. In the wordpress folder create two more folders called Xampp and *migratefiles*. The migratefiles folder will be used to place our WordPress files. The Xampp folder will be used to download the Xampp web software stack from Apache Friends.
Installing prerequisite applications
There are five applications that we need to install ahead of our migration.
- php – installed through Xampp
- composer – this application goes with php
- git for windows
- gcloud sdk
- php-sample-docs
Installing php
Php is a little tricky on Windows to get up and running. Thankfully, Apache Friends have you covered. They have a web server software stack that you can install and it “just works” out of the box. We’ll install this, ensuring we select the up to date php 7.2 version, 7.2.15 (at the time of writing this article).
Let’s go ahead and install the stack. Download the software from Apache Friends and run the installer. Make sure the version you download is 7.2.15. The installation is straight forward, and you only need the php component. You can install all components if required. You can use the screenshots below to follow along with the installation.
<>
Now that we have installed Xampp, we need to ensure we can use php as a command. To do this open Command Prompt and enter ‘php’. You should get the error ”php’ is not recognized as an internal or external command, operable program or batch file.’.
What we need to do is make the php.exe file inside the ~\Documents\wordpress\Xampp\php\ folder run as a command. To do this click on Start, right click on Computer then Properties. Click on Advanced Systems Settings then Environment Variables. In the top section click on New if you do not have a variable called path. If you do have a variable called path, select it and click on Edit. If you clicked on New enter path as your variable and C:\Users<USERNAME>\Documents\wordpress\Xampp\php as your variable value. Click on OK on all windows to apply the new config.
<>
Close down any Command Prompt windows and open up a new one. Type in the following command to check if you’re mapped correctly. If the php path if configured correctly, the php version information will display.
php -v
Installing Composer
Now that we have php installed we need to install Composer. At the time of writing version, 1.8.4 was the latest version. To install Composer, head over to the download page and download and install Composer-Setup.exe.
The setup is simple and should require you to click Next and Install. On the Settings Check screen (screen 2), you need to ensure the php.exe is showing in the dropdown. We set up the path earlier, and it should be available. If for some reason, it is not, you can click on Browse and manually select the php.exe file. You can follow the below screenshots for an installation guide.
<>
Once Composer has completed its installation, close down all Command Prompt windows and open up a new one. Type in the below command, and it should return help information. If you receive this, Composer has installed correctly.
composer
Installing Git for Windows
Git for Windows allows you to communicate with Git repositories. As we need to download files from a Git repo, we need to install this application. There are different Git for Windows options; any of them will do. Download and install the Windows installation file at https://git-scm.com/download/. Version 2.20.1 of Git for Windows was used, at the time of this writing.
When the installer launches, you’ll have quite a few windows and options to go through. Most of the options can be left on their default setting, but I have changed a couple of settings to make things easier. You can follow the below screenshots for an installation guide.
Note 1: one of the options is to open files with Notepad++. You should not be required to install this application. If you receive any errors on this, please install Notepad++.
<>
After the installation has completed, close all Command Prompt windows and open a new one. Type in the below command, and it should return help information. If you receive this, the installation has completed successfully.
git --help
Installing GCloud SDK
The GCloud SDK (short for Google Cloud SDK), is a command line utility that allows you to set up and manage your GCP projects. This client is available for all operating systems.
To install on Windows, head over to the download page and download the GCloud SDK Installer. The download page has a quick guide to install and use the GCloud SDK. Feel free to follow that guide too. There may be some prerequisites before you can use this tool, depending upon your operating system. You can view any dependencies here.
<>
On the final installation screen, ensure you untick Run ‘gcloud init’ to configure the Cloud SDK. As we do not have a GCP project set up yet, there is no need to initialise the SDK.
Downloading php-sample-docs
The php-sample-docs is a collection that Google has put together to allow you to migrate or use different GCP services or components for your php application. The collection is held in Github, under Google Cloud Platform and requires Git to be able to download the collection/repository.
Go to the php-sample-docs Github page and copy the link for the repository. Open a Command Prompt window and change the directory to ~\Documents\wordpress.
Note 1: make sure the branch, on the left, is set to master.
cd ~\Documents\wordpress
Then you will need to clone the php-sample-docs repository into the wordpress folder.
git clone https://github.com/GoogleCloudPlatform/php-docs-samples.git
<>
If you get the wordpress folder, you should see the collection has downloaded to your device.