Jelkner's
Weblog


About me

Blog Posts Blog Tags Blog Feed

2023 2022 2021 2020 2019 2018 2017

Log in

Copyright © 2020
Jeffrey Elkner

The Joy of PHP 1
Aug. 4, 2017


PHP Logo

In a previous post I described the process of setting up a basic virtual machine for PHP development using KVM. In this post I'll decribe how to use it.

KVM is a wonderful tool. It allows me to experiment freely and easily with new technologies without the risk of creating a mess on my host workstation. VMs are quick to create, easy to move from one host machine to another, and integrate seamlessly with an Ubuntu host.

To start my PHP development machine, I launch the virtual machine manager, select the VM I've labelled "PHP Development VM", and click the green arrow icon to start it.

Virtual Machine Manager window

I don't bother openning a display window for a VM like this, since I want to interact with it just like I do with a VM I have on the web, by using ssh to connect to it from a terminal window on my desktop computer.

To find the IP address of the VM, I run:

$ arp -a

and look for a line something like this:

phpdev (192.168.122.136) at 52:54:00:a8:ce:51 [ether] on virbr0

Then I run:

$ ssh phpdev

from my terminal window and login to the VM. Pointing my host machine's web browser at the VM, I can see the output of PHP programs I write.

terminal sshed to VM and browser viewing php page on VM

Time to Start Coding in PHP

Once we at NOVA Web Development made the decision to focus on CiviCRM support, an immediate corrolary is that we will embrace PHP. I've been such an active member of the Python community for so long that this idea didn't come to me without some inner resistance, but now that I've gotten over that, it is time to take the plunge.

My first project will be the NEA Members for Our Revolution website. That site is currently using only static HTML and served up by GitHub Pages. Since adding a third page to the site a few days ago, I am faced with the need to be able to share a common navigation section among the different pages. PHP's include statement is perfect for this task.