Latest Entries »

How to set up a PHP environment in Windows

I was recently trying to clean up my website and the different half-baked projects I have within it. It occurred to me that since the PHP/HTML/CSS combination is so popular and has been around for such a long time, there must certainly be an IDE to develop it, right? Turns out there are a few, but I could not find a good tutorial/walkthrough that explained it. After some searching and testing, here is the set up I came up with. Keep in mind that I'm not a professional PHP developer; this is just a hobby. While I still don't understand what a professional PHP setup looks like, here is the setup that worked for me.

(1) Download Software

Download VirtualBox, Vagrant, and PHPStorm onto your system (Windows). There are many tutorials on how to do this. Installation is pretty straightforward, so I won't get too much into this.

To fully customize the Vagrant box, you'll also need to install GIT on your system (Windows).

(2) Pick a Vagrant Box

I picked php7dev so this tutorial will be based on that. (Some steps might be specific to it.)

NOTE: this Vagrant box is Linux-based. That means my host system (my laptop) is running Windows, and my virtual machine is running Linux.

(3) Set up the Vagrant Box

The following steps are all done in the command prompt window.

These directions are in the github README as well.

  1. Pull the git code (optional).

    This allows you to make customizations to the VM. (You will need to install GIT on your Windows machine if you don't have it already.)
    > git clone

  2. Start the VM. Follow these steps if you pulled the GIT code. Otherwise, follow the "Manual Install" steps from the Github README file.

    > cd <vagrant_directory)
    > vagrant up

  3. Customize the VM.

    All these steps are optional, so customize to your needs.

    Open a command prompt and move to the folder with the VM (if you don't have it open already).
    • Run a different version of PHP. Example: php 5.4
      In the command prompt:
      > newphp.php 54

    • Add a shared folder.

      My code sits on my Windows computer. I added it as a shared folder directly to the Apache folder so that Apache can render it.

      Update the yaml file (php7dev.yaml) with the location of the shared folder (which is sitting on the Windows box) and the location where you want it (Apache's default on this box is /var/www/default/)

  4. Update the VM (optional)
    • SSH into the VM
      > vagrant ssh

    • Run Apache, not nginx
      > sudo service nginx stop
      > sudo apachectl start

    • Add database and tables to mysql on the VM. There are multiple tutorials for the actual MySQL syntax so I won't go too much into that.
      > vagrant ssh
      > mysql -e "CREATE DATABASE <database_name>"
      > mysql -e "CREATE TABLE <table_name> <table description>"

(4) Access the Site

Open a browser window and put this in the address bar:<name_of_shared_folder>

(5) Create the Project in PhpStorm

  1. Start up PHPStorm (on the Windows machine).

  2. Click on "Create New Project from Existing Files"

  3. Click on "Source files are in a local directory, no Web server is yet configured."

  4. Navigate to your shared folder (where your code is).

  5. Click "Finish".

(6) Add the Vagrant box to your project

Since I don't have PHP installed locally (on my Windows box), I need to tell PHPStorm that it's on the Vagrant box.

  1. Go to File > Settings > Languages & Frameworks > PHP

  2. Click the ... box near "CLI Interpreter"

  3. Click the +, then "From Docker, Vagrant, VM, Remote ..."

  4. Click on the bullet for Vagrant.

  5. Click the ... box near "Vagrant Instance" and navigate to your vagrant folder.

  6. Change the "PHP interpreter path" to "/usr/local/bin/php".

  7. Click "Ok". PHPStorm will automatically pick up the PHP version, so double-check that it's the right one (the name will autofill to "Remote PHP <php_version>".

    Click "Ok" and "Ok" to return back to the editor window.

  8. Open a file and start editing!

And that's it, you're set to go!

DJ Sowms

Is Wikipedia Really a Credited Source?

So in my previous post, I mentioned that there was a discrepancy between Wikipedia and an article about the writer formerly known as Abby. I wanted to take a minute and talk about how Wikipedia is now the voice of news ... or rather, the voice of the people, reporting the news.

When I was in school, we weren't able to use online sources, unless you could properly cite an accredited source, and corroborate the story with 2 or 3 other sources. Most of the time, we'd stop at another "proper" source and site that instead. These days, kids are siting Wikipedia as news. I bet a lot of kids have never seen an Encyclopedia Britannica, let alone lugged one around!

And when was the last time you saw an atlas? Remember how he's holding up the world? He'd be so disappointed that no one even remembers him!

In other news (and because I thought it would be inappropriate in the last post), HAPPY NEW YEAR EVERYONE!

DJ Sowms

13 of Dear Abby's best zingers

A bit of sad news: Pauline Friedman Phillips, better known as Abigail Van Buren (as in, Dear Abby), died on Wednesday (according to Wikipedia ... according to the following article, however, it was on Thursday) at the age of 94.

13 of Dear Abby's best zingers

I was reading this article, and did a little checking on her. Did you know that she had a twin sister (Ester Lederer) who is 17 minutes older than her? And more astonishing is that her sister was also employed as a writer, giving advice under a pen name (Ann Landers). Funny how these things work, huh?

DJ Sowms

Please email any comments/questions/thoughts you have about the site to
© 2017 DJ Sowms| Theme based on: Motion by volcanic.|