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

SitePoint PHP Blog:
How to Analyze Tweet Sentiments with PHP Machine Learning
Jul 10, 2017 @ 12:10:52

On the SitePoint PHP blog they've posted a new tutorial showing you how to analyze tweet sentiments using a combination of PHP and machine learning (with the help of the php-ai/php-ml library).

As of late, it seems everyone and their proverbial grandma is talking about Machine Learning. [...] Yes, what about Machine Learning and PHP? Fortunately, someone was crazy enough not only to ask that question, but to also develop a generic machine learning library that we can use in our next project. In this post we are going take a look at PHP-ML – a machine learning library for PHP – and we’ll write a sentiment analysis class that we can later reuse for our own chat or tweet bot.

The post then starts in with some of the basics of machine learning and sentiment analysis and briefly introduces the php-ml library and what functionality it offers. It then outlines the problem they're trying to solve and the solution including what data points php-ml will use to determine the sentiment of a tweet. The author shows how to get the php-ml package installed, how to read in the data set and how to "exercise" the sentiment analysis against the tweets. It describes how the evaluation works and shows the accuracy result of a basic run.

tagged: machine learning phpml library tutorial introduction sentiment analysis

Link: https://www.sitepoint.com/how-to-analyze-tweet-sentiments-with-php-machine-learning/

Juozas Kaziukenas:
From PHP to Machine Code
Mar 28, 2016 @ 09:41:29

In his latest post Juozas Kaziukenas shares a video of his "From PHP to Machine Code" talk he presented at the PHP UK Conference earlier this year (2016).

I recently gave a talk at a few conferences titled “From PHP to Machine Code”. It explains how compilers and interpreters work in general, where are the performance gains to be found and how I applied all of that to build PyHP. PyHP is a little toy project which showcases the basics of taking source code of a programming language and executing it.

As I mention a few times in the talk, it is completely and utterly useless for practical use, but it’s one of the fundamental skill-sets for any programmer. I think knowing how a bunch of text makes a computer do things at the low level is required knowledge for everyone.

The video of the presentation is embedded in the post or you can watch it directly over on YouTube if you'd like. In it he walks you through the entire process that happens from the time the PHP is executed all the way down to opcodes and bytecodes.

tagged: video presentation phpuk16 conference bytecode compiler machine code execution

Link: https://juokaz.com/blog/from-php-to-machine-code.html

JetBrains Blog:
Docker Support in PhpStorm
Nov 03, 2015 @ 10:08:35

In this recent post to the JetBrains blog they show how to set up and configure the Docker support the latest version includes built in to the IDE.

Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.

With the new Docker integration plugin for PhpStorm, you can add Docker support to existing projects, view logs, manage Docker containers, and debug PHP web applications from right inside PhpStorm.

They help you get the integration plugin installed and show you where the machine should be located and how to set it up under PHPStorm's deployment options. Next up they include the steps for getting the Docker machine up and running (again, inside the IDE) and managing the containers related to the machine.

tagged: docker support phpstorm ide jetbrains container machine

Link: http://blog.jetbrains.com/phpstorm/2015/10/docker-support-in-phpstorm/

Dutch Web Alliance:
Docker & PHP: beyond virtual machines
Nov 13, 2014 @ 13:09:21

On the Dutch Web Alliance site there's a recent post from Michael Rook introducing you to using Docker with PHP. Docker is a configurable system allowing you to script the creation and setup of an environment, piecing software and components together in an easy, reproducible way.

Docker is currently one of the hottest technologies around, because it solves a very specific problem: the ability to easily package and deploy a (self contained) application, without the overhead of traditional virtualization solutions. In this post you’ll learn how to build, run and host Docker containers, integrate with other containers, and see how Vagrant interacts with Docker.

The post walks you through the steps you'll need to get an instance up and running with PHP setup and configured:

  • Installing Docker
  • Creating and starting a container
  • Dependencies: linking containers
  • Using Docker & Vagrant

In the end, you'll have a virtual instance and environment with PHP installed. All commands and configuration/code needed is included in the post.

tagged: virtual machine docker tutorial introduction vagrant

Link: https://dutchweballiance.nl/techblog/docker-and-php-beyond-virtual-machines/

SitePoint PHP Blog:
Build Virtual Machines Easily With PuPHPet
Dec 19, 2013 @ 11:42:32

On the SitePoint PHP blog today Matthew Setter introduces you to a tool that can help make the setup and configuration of your Vagrant/Puppet development environments a lot easier - PuPHPet.

I can't speak for you, but one of my pet peeves about software development is environments. Whether it's creating and maintaining them for different projects with different needs; ensuring environment parity across a development team, (especially when they're remote); or between environments such as development, testing, and production. Across all of these, it can be a laborious task, especially when done manually. [...] In pursuit of ending this pain and making the entire process as efficient as possible, I set about the task of learning Vagrant & Puppet. [...] However, like most people in the modern world, I'm impatient. Like you, I have a lot going on, plus I was not seeking to become a guru. I felt there must be a way to come up to speed quickly but without becoming an aficionado.

This "better way" cam in the form of PuPHPet, a GUI tool (web-based) that lets you specify the options you want included in the configuration and generates the needed configuration files for you. This tool (created by Juan Treminio) makes it a lot simpler to get up and running quickly. Matthew walks you through a sample configuration and, with screenshots, and show you how to specify options for things like the web server, server software to install and PHP extensions to include.

tagged: puphpet virtual machine vm puppet vagrant development environment

Link: http://www.sitepoint.com/build-virtual-machines-easily-puphpet/

Facebook invents a PHP virtual machine
Aug 08, 2013 @ 10:20:54

On JavaWorld.com there's a new article posted about an update Facebook has made to their HipHop virtual machine (HHVM) version that is supposed to execute PHP nine times faster than its normal rate.

Social networking giant Facebook has taken another step at making the PHP Web programming language run more quickly. The company has developed a PHP Virtual Machine that it says can execute the language as much as nine times as quickly as running PHP natively on large systems.

An engineering manager for Facebook pointed out the goal of the update - "to make PHp run really, really quickly." The HHVM compiles down the PHP code into C and executes it directly, removing the need for the PHP interpreter.

HHVM is the next step for Facebook. Under development for about three years, HHVM actually works on the same principle as the JVM (Java Virtual Machine). HHVM has a JIT (just-in-time) compiler that converts the human readable source code into machine-readable byte code when it is needed. (The previous HipHop, renamed HPHPc, has now been retired within Facebook.)

You can find out more about the HipHop virtual machine over on Facebook.

tagged: facebook virtual machine hiphop vm execution compile

Link: http://www.javaworld.com/javaworld/jw-07-2013/130726-facebook-invents-php-virtual-machine.html

Allan MacGregor:
An Introduction to HHVM
Jul 26, 2013 @ 10:24:52

Allan MacGregor has posted a (high level) introduction to the HipHop Virtual Machine (HHVM) that was created by Facebook to address some of their PHP-related needs inside their platform. It sacrifices some things in the name of speed and less resource consumption.

In early 2008 Facebook began working on HipHop(now HPHP), a PHP execution engine; its original motivation was to convert Facebook massive PHP code base into C++ in order to save resources and increase the application performance. [...] At it’s peak, HipHop PHP code showed up to 6x times better performance than its ZEND counterpart. However, there where several drawbacks to this first iteration of HipHop. [...] At the same time Facebook started the development of the modern version of HipHop, known as HHVM (HipHop Virtual Machine), HHVM improves the strengths of HPHPc and corrects many of the critical problems.

He talks some about Facebook's efforts to open source the platform and what the HipHop VM does to make your PHP code execute that much faster. It's all about bytecode, machine code and a JIT (just in time) compiler where the bytecode is parsed during execution instead of before.

Currently HHVM supports PHP 5.4 almost on its entirety, however there are still numerous bugs that prevent some applications from running, for that reason Facebook has set as goal to have the top 20 open source PHP applications running on HHVM. The first popular application to achieve this was Wordpress.
tagged: introduction hhvm hiphop virtual machine facebook bytecode jit compiler

Link: http://coderoncode.com/2013/07/24/introduction-hhvm.html

Justin Carmony:
Vagrant & PHP: Our Success Story at the Deseret News
Sep 17, 2012 @ 09:51:26

Justin Carmony has shared his success story about the use of Vagarant and PHP as a platform to make setting up and configuring developers' environments simple.

Now-a-days, you have frameworks that need to be setup [as a part of your environment], include paths that need to be changed, modules that need to be installed, web servers that need to be configured for your routing, etc. Then you might not just have MySQL, but Redis, Mongo, Couch, Memcached, Postgres, or any other dozen other servers. Then in Production you might have load balancers, multiple web servers, clusters of databases, and the list goes on. Simply put: web development environments are complex.

He introduces Vagrant and talks a bit about how it helped them with the setup and configuration of two new remote developers they had limited contact with. After some initial quirks, Vagrant made it simple for them to get up and running with new environments in a day.

tagged: vagrant environment virtual machine vm successstory


Juan Terminio's Blog:
Setting Up a Debian VM, Step by Step
Jul 04, 2012 @ 13:01:32

In this new post Juan Terminio shows you how to set up a new virtual machine (VM) that hosts a Debian system (replacing the setup of his previous tutorial for setup of a Ubuntu system) in VirutalBox.

Previously, I created a tutorial on installing a 32-bit Ubuntu VM with PHP 5.3.x. I’ve since moved on to PHP 5.4.x and Debian, which is universally considered a safer bet for a server OS. This tutorial is what I will point back to in the future when I want to show people how to create a VM, so you should consider the Ubuntu-based tutorial obsolete. In reality, Ubuntu is based on Debian, so the bulk of this tutorial will be very similar to the Ubuntu one, albeit with some minor changes here and there.

He starts with a few reasons to use a VM over the more traditional single development system mentality including keeping the "server" off your desktop and the dev-to-production similarity needs. He shows how to use the VirtualBox software and a Debian ISO to create the VM, complete with screenshots of each step of the way (for both host and guest OSes). He also helps you get a few things installed including sudo, setting up the network, configuring the hosts file and installing some common utilities as well as the MySQL, Apache, PHP and Samba combination (with PHP compiled from the 5.4.x source).

tagged: debian virtual machine vm tutorial virtualbox install


Ben Ramsey's Blog:
Build PHP 5.4 on CentOS 6.2
Mar 06, 2012 @ 09:58:38

In this latest post to his blog Ben Ramsey shows you how to, inside of a virtual machine, set up a server with PHP 5.4 installed (using CentOS 6.2).

In case you haven’t heard the news, the PHP project released version 5.4.0 last Thursday. Naturally, I decided it was time to install and give it a try. I chose to install to a clean and bare-bones CentOS 6.2 virtual machine using VirtualBox. I did this for two reasons: 1) I wanted a clean environment for the build, and 2) I wanted to play with CentOS. At the time of this writing, there are not yet any official CentOS RPMs for PHP 5.4, so I had to build PHP from source. What follows are the notes I took during the installation and build process. I hope you find them helpful.

His instructions cover the full process:

  • Installing the CentOS operating system
  • Creating a non-root user
  • Setting up the network for local access
  • Installing the packages for PHP (via yum)
  • Grab PHP 5.4 and compile it
  • Testing out the web server with a sample phpinfo file

He includes a lot of extensions in his installation, some you may not need like pspell, tidy, calendar, ftp or xsl.

tagged: virtual machine virtualbox centos install process tutorial