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

Lorna Mitchell:
Test Your PHP Application on PHP 7
Jul 24, 2015 @ 09:06:53

Lorna Mitchell has a post to her site showing you how to get a PHP7 setup and working so you can test out your current application, preparing it for this next major version's release.

PHP 7 is coming, which is nice, but what does it mean for the majority of PHP developers? PHP as a community is notoriously slow in adoption, some of us are still waiting for 2012's new shiny to be available as standard on our hosting platforms. However with the performance benefits and a few really nice new features, PHP 7 is well worth everyone's attention, and it's actually quite easy to get started so here's my quick howto.

The large part of the post is the steps you'll need to get the php7dev box (from Rasmus Lerdorf) up and running, complete with a shared folder mounted from your local machine and a custom Nginx configuration. She also mentions the "Go PHP7" initiative that's aiming to help make the transition to PHP7 as easy as possible for everyone (including various extensions).

tagged: test application php7 php7dev vm virtualmachine setup configure

Link: http://www.lornajane.net/posts/2015/test-your-php-application-on-php-7

Sameer Borate:
Accessing WordPress data using the new REST api
Jul 16, 2015 @ 09:53:57

Sameer Borate has posted an article showing you how to use the WordPress REST API (set up by this plugin) to access the data housed inside your WP installation.

WordPress is without doubt the most used CMS system around. Various sources peg the usage around 20-30% of all web sites. Whatever the correct figure, there is no doubt that the collective content of WordPress sites is enormously large. However almost all content is virtually held in independent WordPress sites with no way to easily access a sites content programmatically. [...] As WordPress is moving towards becoming a fully-fledged application framework, we need new APIs. At present a REST api plugin is available to access your site’s data in simple JSON format, including users, posts, taxonomies and more.

He walks you through the installation of the plugin and how to make a request to the REST API's test endpoint to ensure everything's functioning correctly. He also includes an example request that fetches the contents of a post by it's ID. The tutorial wraps up with a look at authentication and how the plugin provides two kinds of handling: basic authentication (HTTP Auth) and OAuth. You can find out more about the structure and functionality of the API on the project's website.

tagged: wordpress rest api tutorial installation setup plugin

Link: http://www.codediesel.com/wordpress/accessing-wordpress-data-using-the-new-rest-api/

DigitalOcean Community Blog:
How To Deploy a Basic PHP Application using Ansible, Part2
Jun 26, 2015 @ 09:53:33

Digital Ocean has continued their series about deploying "advanced PHP applications" on an Ubuntu instance via Ansible in part two of the series. If you missed the first part of the series, you can check it out here.

This tutorial is the second in a series about deploying PHP applications using Ansible on Ubuntu 14.04. The first tutorial covers the basic steps for deploying an application, and is a starting point for the steps outlined in this tutorial.

In this tutorial we will cover setting up SSH keys to support code deployment/publishing tools, configuring the system firewall, provisioning and configuring the database (including the password!), and setting up task schedulers (crons) and queue daemons. The goal at the end of this tutorial is for you to have a fully working PHP application server with the aforementioned advanced configuration.

You'll need to finish the first tutorial if you want to follow along here. They pick up where they left off to finish the whole process, starting with a switch to a more advanced example repository. They modify the Ansible configuration and run the playbook to update the host. From there they break things down into several more steps:

  • Setting up SSH Keys for Deployment
  • Configuring the Firewall
  • Installing the MySQL Packages
  • Setting up the MySQL Database
  • Configuring the PHP Application for the Database
  • Migrating the Database
  • Configuring cron Tasks
  • Configuring the Queue Daemon

While a good bit of these steps relate to something Laravel needs (what they use for the sample application), it's still a good overview of the wide range of things you can do with Ansible during deployment.

tagged: deploy ansible digitalocean setup tutorial configure laravel framework part2

Link: https://www.digitalocean.com/community/tutorials/how-to-deploy-an-advanced-php-application-using-ansible-on-ubuntu-14-04

New Media Campaigns:
Docker for PHP Developers
Jun 02, 2015 @ 10:29:38

The New Media Campaigns site has posted a new tutorial today introducing PHP developers to Docker, the handy tool to create containers for your applications a bit simpler and more efficient than just something like Vagrant.

I've used Vagrant to manage local development servers for several years. Vagrant is, according to its official website, a tool to "create and configure light-weight, reproducible, and portable development environments." [...] However, Vagrant has one large downside—it implies hardware virtualization. This means each project runs atop a full virtual machine, and each virtual machine has a complete operating system that demands a large overhead in system resources.

[...] There is another solution, though. Have you heard of Docker? I first heard this word a year ago. It's all about containers, I was told. Awesome. What are containers?, I thought. I dug deeper, and I read all about containerization, process isolation, and union filesystems.

He starts with a brief introduction to what Docker is and two of the key concepts: containers and images. He then talks about how Docker is different from Vagrant, including the extensibility and lighter resource demands. Following all this he starts in on building an actual application in a container. He walks you through each step, including commands, to build the container and image that will result in the final instance running Ubuntu, MySQL, Nginx and PHP-FPM. He sets up a simple "Hello World" page and shows how to configure the Nginx server to serve it up as well as the MySQL server to cooperate with PHP and run locally.

tagged: docker introduction container image configure server setup tutorial

Link: http://www.newmediacampaigns.com/blog/docker-for-php-developers

DigitalOcean Community Blog:
How To Deploy a Basic PHP Application using Ansible on Ubuntu 14.04
May 13, 2015 @ 10:15:16

If you've ever been interested in learning Ansible and how to use it in deploying your PHP applications, you should check out this new tutorial from Stephen Rees-Carter on the DigitalOcean blog. He walks you through the full process for getting the server and application set up and configured just the way you need it (on a Ubuntu server).

This tutorial covers the process of provisioning a basic PHP application using Ansible. The goal at the end of this tutorial is to have your new web server serving a basic PHP application without a single SSH connection or manual command run on the target Droplet. We will be using the Laravel framework as an example PHP application, but these instructions can be easily modified to support other frameworks and applications if you already have your own.

He starts with a list of the things you'll already need installed and things to know including a basic understanding of Ansible and two servers (they use their own Droplets in the examples). From there, they walk you through a seven step process to get the automated deployment up and running:

  • Installing Ansible
  • Installing Required Packages
  • Modifying System Configuration Files
  • Cloning the Git Repository
  • Creating an Application with Composer
  • Updating Environment Variables
  • Configuring Nginx

Some of the steps here are Laravel-specific as mentioned but if you're familiar with the setup of your own application, it's pretty easy to adapt. Each step includes the configuration changes and commands you'll need to complete it.

tagged: deploy ansible digitalocean setup tutorial configure laravel framework

Link: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-basic-php-application-using-ansible-on-ubuntu-14-04

Gary Hockin:
Debugging PHP Command Line (with PHPStorm and XDebug)
May 07, 2015 @ 11:47:09

Gary Hockin has a recent post showing how you can debug PHP HTTP requests from the command line using PHPStorm and XDebug. These instructions aren't specific to PHPStorm, however. They can be used in any IDE/editor that supports remote XDebug connections.

At PHP North West I had huge difficulties configuring Xdebug and both my PHP and PHP Storm so they play nice in a CLI environment. So here, for others and almost certainly my future self, is how to do it.

He goes through each step of the setup process assuming that you already have the necessary software installed. He shows how to configure XDebug for remote debugging in the ini configuration, setting up PHPStorm to receive the connection and, finally, adding the "XDEBUG_CONFIG" environment variable to tell PHP to relay the requests back to your waiting IDE.

tagged: remote debugging phpstorm commandline xdebug configure setup environment

Link: http://blog.hock.in/2015/05/04/debugging-php-command-line-with-php-storm/

SitePoint PHP Blog:
Inspecting PHP Code Quality with Scrutinizer
Apr 29, 2015 @ 11:24:24

The SitePoint PHP blog has a recent tutorial showing you how to use the Scrutinizer service to evaluate the quality and "pain points" in your PHP code, be it a library or full application.

We’ve gone through a decent number of tutorials about code quality, inspections, auto-build systems and so on here at SitePoint. [...] In this article, we’ll take a look at Scrutinizer CI – a continuous integration tool that’s quite expensive and closed to private projects, but very handy for public ones.

He starts with a quick comparison of Scrutinizer versus (and really plus) the popular CI service Travis CI. He then walks you through the setup of Scrutinizer to evaluate your application automatically when code is pushed to GitHub. He then gets into the configuration options the service provides including filters, specific checks to evaluate and other tools to execute in the evaluation build. The article then gets into examples of the reports that are provided and a bit of detail about what each view provides. There's also options to hide certain errors that you know aren't actually problems and the "follow up" links it provides for the issues you may not understand.

tagged: inspect code quality scrutinizer tutorial setup configure

Link: http://www.sitepoint.com/inspecting-php-code-quality-scrutinizer/

Alex Bilbie:
Setup Jenkins and test a PHP project
Apr 20, 2015 @ 10:14:32

Alex Bilbie has posted a new tutorial to his site showing you how to set up Jenkins to test a PHP project. Jenkins is a popular automated build tool that can be used to do helpful things like automatically run unit tests and execute other tasks when code changes happen (or on an automated schedule).

After a chat with some other developers on Twitter the other day I offered to write a tutorial on how to setup Jenkins from scratch and create a job to test a PHP project. For this tutorial I'm going to use a Digital Ocean droplet (get $10 free credit with this link) but you can use a server from anywhere. Once I've installed and setup Jenkins I'm going to create a job to test my Proton framework.

He walks you through the setup of the server (Ubuntu running on a Digital Ocean instance) and the commands you'll need to get the required tools installed, including Jenkins. He configures Nginx to work as a proxy for the Jenkins installation (config included) and how to secure the installation. This is done via a GitHub OAuth connection and plugin. He helps you get Composer installed, an SSH in place for committing back to GitHub and creating a first job. He also includes a listing of several helpful tools that can be used to test your scripts and applications to provide more detail and better quality to the resulting code.

tagged: jenkins test setup project tutorial digitalocean ubuntu

Link: http://alexbilbie.com/2015/04/setting-up-jenkins/

Mike Bronner:
How To Install PHPCI in Homestead
Apr 10, 2015 @ 08:54:19

Mike Bronner has a new post on Medium.com about installing PHPCI on a Laravel Homestead instance and have it able to execute your builds.

PHPCI is a nifty little swiss-army-knife for your development toolbox. [...] It will monitor your source repositories for changes, and trigger a new build when it sees activity. Then it will let you know if anything went wrong or can be improved. This comes in handy to improve your code quality and minimize errors and issues down the road. In the following section we’ll go through the process of installing PHPCI in Homestead.

He goes through the full process of getting the necessary software installed and all of the commands you'll need to:

  • Adding the PHPCI database
  • Clone the PHPCI code
  • Configure the PHPCI install
  • Set up the cron to run automatic builds
  • Configure MySQL
  • Set up the Homestead instance for the new PHPCI site

Check out the full post for more details.

tagged: homestead laravel phpci setup configure install tutorial commands

Link: https://medium.com/@genealabs/how-to-install-phpci-in-homestead-5ee0b022e8be

Using HHVM With WordPress
Mar 31, 2015 @ 12:11:03

On the NetTuts.com site today they've posted a new tutorial showing you how you can use WordPress with HHVM now that they're 100% compatible.

Over the past few months HHVM has taken the PHP community by storm. Since WordPress 3.9 was released, HHVM is now 100% compatible with WordPress.

Unfortunately, HHVM is not quite ready for use in production in self-hosted environments. In my experience, HHVM crashes about once per day, which makes it not viable for a site where high availability is important. Recently, WP Engine has released project Mercury which seamlessly allows HHVM to gracefully fail by falling back to PHP 5.5 when it fails. In this article, we're going to install HHVM on an Ubuntu server running the latest LTS release, 14.04.

They walk you through the full process including:

  • installing MySQL
  • Installing Nginx
  • Installing HHVM
  • Setting up and configuring them all to play nicely with WordPress

It's a pretty short article and doesn't get into the specifics of the WordPress setup steps past ensuring it's working with HHVM but it does give a good starting place.

tagged: hhvm wordpress setup tutorial configure install ubuntu

Link: http://code.tutsplus.com/articles/using-hhvm-with-wordpress--cms-21596