Category Archives: Web

Internet, web design and programming, etc.

Migration of WP to new Bitnami instance on AWS Lightsail

My original WordPress instance on AWS was showing me that its using an old version of PHP that wasn’t supported anymore. I was reluctant to move to a new WordPress instance, thinking it’s going to be sooo complicated, and how I’m going to handle the IP address change, and do I need to do HTTPS certificates all over again, …

It turned out it’s sooo simple! I’ve read these two posts several times: Update PHP Version On Bitnami WordPress On AWS Lightsail and Updating PHP on an AWS Lightsail WordPress Stack. They helped me a lot to understand the process. I didn’t follow them to the letter, my case was a bit simpler than theirs.

First thing on the list was to update the WordPress to the latest version and then back up the WordPress installation. That involves installing the All-In-One WP Migration plugin and exporting data to a safe temporary storage (eg. local hard drive).

Next step is to create a new Bitnami WordPress instance. Wait several minutes for it to be completed. If you try to get into the instance with the SSH console it will give you an error if it’s not done yet. Attach a static IP to it, then you can add your domain to that static IP. I’m using AWS name servers, that’s why it turns out to be simpler than most cases. SSH into the instance and run:

sudo /opt/bitnami/bncert-tool

Answer all the question. Now you can get to your WordPress website. It shows default theme with no posts – they haven’t been imported yet. Update WP to the latest version and install the All-In-One WP Migration plugin. Edit php.ini:

sudo vi /opt/bitnami/php/etc/php.ini

; Maximum size of POST data that PHP will accept.
post_max_size = 100M

; Maximum allowed size for uploaded files.
upload_max_filesize = 100M

Change these two values if needed to whatever they need to be – bigger than the size of the backed up data file. Restart the services on the instance:

sudo /opt/bitnami/ctlscript.sh restart

Log into the WP Dashboard and import the data file into the WP using above mentioned plugin. Everything will be restored. Done!

Outside temperature, frozen!

The Raspberry Pi in the garage that measures temperature connects to the house network through wireless. Sometimes the wireless USB stick goes wonky and loses connection to the house (and to the rest of the world) and temperature on this web site won’t get updated periodically. I have to go to the garage and pull the stick from the port, put it back again and it will reestablish connection.

I just came back in from cleaning the sidewalks, it’s heavily snowing, and I don’t feel like going back to the garage just to reset the stick. It can wait a bit!

Outside temperature

And finally, the upload of the temperature from my backyard works! See it in the side bar, above the Search field, and in the footer area at the bottom of the page. It uploads new measurement every ten minutes.

New WP site

This is my temporary web site, intended to serve as a sand box for learning more about WordPress. It will evolve, grow, change, and very often – be broken.

I’ve been using / playing with WP since Mingus (v1.2). It was residing on different web servers that I was building and killing in my basement. Each of those servers had an installation or two of the WP. Although I can be considered as an experienced WP user, I was only that – just an user. Trying different plugins, themes, little bit adjusting some of the themes … Nothing seriously. No consistent posting, no big traffic, no big deal.

Now, although I don’t work in the web industry as a professional anymore (been there from the end of the ’90s – ’till around 2003), I can confidently say that I have necessary skills for more serious meddling with the WP. HTML, CSS, JavaScript, PHP, … everything is here, it’s just little bit rusty. Engine needs some oiling and TLC. That’s going to be purpose of this site.

Piece of an old PHP code

I was going through some old notes today. Found cute little piece of the php code. Here’s to try wordpress’ sourcecode tag:

$self = $_SERVER['SCRIPT_NAME'];

if (isset($_COOKIE['style'])) { 
  $stil = $_COOKIE['style']; 
} else { 
  $stil = 'default'; 
}

if (isset($_COOKIE['lang'])) { 
  $lang = $_COOKIE['lang']; 
} else { 
  $lang = 'en'; 
} 

if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['pazi'] == 'sad') {
  setcookie('style',$_POST['izbor'],time()+6000000,'/');
  Header("Location:$self"); 
} 

if ($_SERVER['REQUEST_METHOD'] == 'GET' && (isset($_GET['ln']))) { 
  setcookie('lang',$_GET['ln'],time()+6000000,'/'); 
  Header("Location:$self"); 
} 

Looks like it works, eh? How about some arduino code?

/*
Blink

Turns on an LED on for one second, then off for one second, repeatedly.

The circuit:
* LED connected from digital pin 13 to ground.

* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.

Created 1 June 2005
By David Cuartielles

http://arduino.cc/en/Tutorial/Blink

based on an orginal by H. Barragan for the Wiring i/o board

*/

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}