Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Master Zend Framework:
How To Build a Local Development Environment Using Docker
Sep 02, 2016 @ 11:57:05

The Master Zend Framework site has posted a tutorial helping you create a Docker-based development environment complete with PHP, MySQL and Apache working happily together.

Why in this modern day and age is setting up a development environment still such a complicated process? [...] Why is it still so hard to get one setup that works, that does what you need, and that matches the deployment environment’s of testing, staging, production and so on?

[...] By now our development environments have grown quite sophisticated. But the overhead of both building and maintaining them has increased significantly also. Wouldn’t it be easy if we could set them up, but with only a small investment of time and effort? I think you know where I might be heading with this. You can. Yes, that’s right, you can. Ever heard of Docker?

He then starts in on introducing Docker (for those not already familiar) and how it differs from a VirtualBox/Vagrant setup that's already become quite popular. He talks about "containers" and the role they play as well as an overview of the environment he's going to show you how to create. He then helps you get Docker installed, explains how the containers will work together and provides the Docker YAML configuration for each of them. The docker-compose command is then used to bring the environment up, downloading the containers as needed. The final result of his setup is a set of containers running together to serve up a Zend Framework Skeleton Application.

tagged: docker local development environment tutorial introduction mysql apache zendframework skeleton

Link: http://www.masterzendframework.com/docker-development-environment/

Zend Developer Zone:
Testing your project with PHP 7.1
Aug 23, 2016 @ 12:20:12

On the Zend Developer Zone author Cal Evans has written up a post showing you how to test your application with PHP 7.1, the upcoming minor release version for the PHP 7.x series.

Both PHP 7.0 and the upcoming PHP 7.1 release are fairly benign releases. They do not break backwards compatibility except in a few edge cases. If you’ve not yet moved to PHP 7.0, check out our posts tagged php7 for details on what might trip you up there.

Regardless of what version you are moving to, 7.0 or 7.1, you are going to want to test your application before you make the move in production. Sometimes that is difficult though you need a server properly configured, you need someone to manage it, most importantly, you need unit tests. While I can’t help you with that last one – other than point you to @grmpyprogrammer who will publicly abuse you until you write them – I can help you with the “where to test” problem.

Cal shows how to make use of Docker containers to easily test your application in a more self-contained environment and make it simpler to swap out the PHP versions in your platform. He walks you through the steps you'll need to follow to get the environment set up, pull down required components, install and compile PHP and, finally, install Composer globally. Once set up, he shows how to log in, clone your project and execute its test suite. He finishes the post with a few comments about this being a "sandbox", not a CI environment and how it is "future proof" for later versions of PHP too (as it doesn't lock it down to just PHP 7.1.x).

tagged: testing project php71 docker container tutorial

Link: https://devzone.zend.com/7262/testing-project-php-7-1/

Symfony Finland:
Consider Docker for your Symfony projects
Aug 15, 2016 @ 11:24:35

On the Symfony Finland site there's a post that makes a recommendation for your Symfony framework based projects: give Docker a try to make setup and maintenance simpler.

During the first half of 2016 the web development community has talked about Docker quite a bit. The technology has been around since 2013, but during the last few months it has matured and started being adopted for mainstream web development. Docker is a great fit for Symfony projects too.

[...] Docker takes an approach where it wraps a piece of software into something known as a container. These containers are shipped complete with the application code, a runtime, system tools and libraries. Containers are thus guaranteed to always run the same, but can share files and networking with the host and other containers.

They then talk about how this "containerized" setup can be used to your advantage, making it simpler to get a Symfony application up and running with a few commands. The post then gets into an example setup of a Symfony Docker environment complete with Nginx, Varnish and PHP-FPM installed and linked. There's also setup for MySQL and Redis rounding out the data storage side. A quick "docker-composer up" command and, if all goes as expected, the environment is set up and waiting for your application.

tagged: symfony finland docker project tutorial setup configure

Link: https://www.symfony.fi/entry/consider-docker-for-your-symfony-projects

ShippingDocker.com:
Testing in Docker (Using Different PHP Versions)
Aug 12, 2016 @ 12:23:58

On the ShippingDocker.com site there's a video (and matching tutorial) posted showing you how to use Docker to test with multiple PHP versions with relatively little difficulty. In this case they're not testing the frontend of the application, they're running its unit tests.

[This is a] quick video on running PHP unit tests against different versions of PHP using Docker. [We'll] cover unit testing with PHP.

They start with an example of using the pywatch tool to do the testing without Docker, automatically executing the tests when something changes. This has the limitation of only being able to use your current, local version of PHP. They then shift over to the Docker side of things and show how to run the same pywatch command inside a container of your choosing, tagging it with the PHP version and making it easy to switch between them in the future.

tagged: docker version unittest different example video screencast tutorial

Link: https://shippingdocker.com/blog/docker-testing/

Chris Tankersley:
My Docker Setup
Jul 29, 2016 @ 11:56:11

Docker has quickly become one of the tools that have helped make difficult environment setup and thing of the past. Chris Tankersley, a PHP developer and devops practitioner, has shared some about his own PHP Docker workflow in a new post to his site.

When it comes to Docker, I use Docker Compose to set up and link all of my containers together. It's rare that I have a single container, though many of my Sculpin-based sites live quite comfortably inside of an nginx container, but even those take advantage of volumes.

For his standard three-tier setup he defines a basic docker-compose.yml configuration file with required services (nginx, PHP server, MySQL and Composer), local volume information and the links between them. With that working he uses another script to set up some PHP extensions and Composer as a service (making it a service provides isolation). He also includes the scripts he's written up to help run a few extra commands and execute the Composer and PHP commands much easier. He wraps the post up talking about how all of this fits into his overall workflow and how it relates to the deployment of the application into other environments.

tagged: setup environment workflow setup docker configuration deployment

Link: http://ctankersley.com/2016/07/27/my-php-docker-workflow/

PHP Roundtable:
048: Docker & PHP
Jun 27, 2016 @ 11:19:36

The PHP Roundtable podcast, hosted by PHP community member Sammy K Powers, has posted their latest episode today. In Episode #48 Sammy is joined by Phillip Shipley and Chris Tankersley to talk about Docker.

The demand for DevOps skills is growing more and more in modern web development. But all the hype and demand is met with myriad DevOps tools. Staying abreast of how these tools can help make our jobs easier can be daunting. So today we take a closer look at one of these tools called Docker which takes a microservices-architecture approach to managing your servers.

You can catch this latest episode in a few different ways: either through the in-page audio or video players or by checking it out directly over on YouTube. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get the latest updates on shows as they're released.

tagged: phproundtable podcast ep48 docker christankersly phillipshipley

Link: https://www.phproundtable.com/episode/docker-and-php

James Wade:
Getting started with Docker and Wordpress
May 06, 2016 @ 11:57:31

James Wade has posted a tutorial to his site showing you how to combine Docker and WordPress after some experimentation of his own.

I’ve been meaning to get started with Docker since hearing about it in 2014. Having really enjoyed working with Vagrant, I’ve struggled to make a leap into the Docker realm. [...] My understanding at the moment is that docker takes up less resources, which for me is becoming more and more of an issue as I attempt to expand my development environments. Also, I’ve recently inherited a number of Vagrants that I discovered have varying operating systems and application versions, that vary from production.

This has unravelled a dependency hell when I came to build a continuous integration process. In light of this, at this stage, a complete rewrite of the architecture seems to be emerging as the most sensible way to being all the services in to line. I’ll be looking whether I can solve these problems (amongst others) with Docker.

He starts by helping you get all the tools you'll need installed with examples for multiple platforms (OSX, Windows, Unix-based). With those in place he helps you set up a VM as a Docker machine then get WordPress installed (complete with its database). He also shows how to use Docker Compose, using an existing WordPress instance and creating a custom image from the results (including database, environmental settings and hostname configuration).

tagged: docker wordpres tutorial example compose setup configure vm virtualmachine

Link: http://wade.be/development/2016/05/02/docker.html

Phillip Shipley:
Docker makes upgrading to PHP7 easy
Apr 25, 2016 @ 11:13:07

In this post to his site Phillip Shipley talks about Docker and how using it for your PHP deployments can make it much easier to upgrade to PHP 7.

Last year at php[tek] 2015 during the hack time I messed around and created a Docker image to run and test PHP7. It was surprisingly easy and I quickly learned that the app I was working on at the time ran fine in PHP7, good deal. So since then I’ve been awaiting the general availability release of PHP7 to move forward with upgrading my apps.

The main thing holding me back was I just didn’t want to maintain an image based on compiling from source. Not that it’s a problem, it just didn’t feel as clean and simple as using supported packages.

He points out that Ubuntu 16.04 was released and that does now have PHP 7 as a standard package so he's happily upgrading. He gets into a bit of detail about how upgrade process and some of the smaller issue he faced along the way. He also includes the update to his Dockerfile he made to change to PHP 7 (only a few characters) to rebuild with PHP 7.0.4.

tagged: upgrade php7 docker ubuntu package official release

Link: http://www.phillipshipley.com/2016/04/docker-makes-upgrading-to-php7-easy/

SitePoint PHP Blog:
Containerized PHP Development Environments with Vagga
Apr 13, 2016 @ 10:19:07

The SitePoint PHP blog recently posted a tutorial showing you how to use Vagga to "containerize" your development environment and help prevent some of the common incompatibility issues that come with setting up/configuring them.

It happens to all of us once in a while. We clone a project, and then we try to run it. However, something doesn’t work. It may be our version of NGINX or Apache. It might be that npm isn’t doing something right. Maybe the project needs an extension, and we don’t have it installed, and now we have to build the extension from source because the dependency does not exist in the repositories for our distribution. No matter the reason, the more complex the setup, the higher the probability of failure.

He sets up a scene where a developer, the primary on a certain product/project is out of the loop and changes need to be made. He steps through the problems another developer could have with setting up a similar environment and, unfortunately, the issues that come from it. Enter Vagga a tool that helps to set up development environments with containers, handle dependencies and run simple processes.

The tutorial then introduces the tool, helps you get it installed and shows how to create a simple environment. Their example uses just Nginx and PHP containers along with mounted volumes, custom configurations and simple command execution to automagically build the environment exactly as needed.

tagged: vagga container development environment docker tutorial

Link: http://www.sitepoint.com/containerized-php-development-environments-with-vagga/

Geeky Platypus Blog:
Dockerise your PHP application with Nginx and PHP7-FPM
Apr 06, 2016 @ 11:57:58

The Geeky Platypus Blog has a new post showing you exactly how to Dockerise your PHP application with a PHP7-FPM and Nginx setup.

The goal that we will try to achieve is to run a simple PHP application using the official Docker repositories for both PHP and Nginx. There are several docker repositories combining PHP-FPM with Nginx, but depending on the official repositories gives you several benefits, like using a service which is configured by its maintainers and you can always choose between the latest and greatest or different versions of both services, instead of relying on someone else’s choices.

The tutorial assumes you already have both Docker and Docker Compose installed, so do that first if you don't. Then you can follow along with the rest of the steps:

  • Setting up Nginx
  • Adding PHP-FPM
  • Setting up a mount point (in the filesystem) to your code

If all goes well you should have a complete setup of PHP 7 and Nginx running your application. If you'd like to see the complete project for reference, you can find it over on GitHub.

tagged: docker nginx php7fpm tutorial setup configure

Link: http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/