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

Derick Rethans:
Good Bye PHP 5
Jan 11, 2017 @ 10:13:53

On his site Derick Rethans has posted an announcement about a major change in the Xdebug project (a widely used PHP debugger) he leads, saying goodby to PHP 5.

A few days ago I merged a patch into on GitHub. Maintaining PHP 5 and PHP 7 support in one code base is not particularly easy, and even more complicated for something like Xdebug, with its deep interactions with PHP's internals.

As PHP 5.6's active support has ended on December 31st, I also felt it no longer needed to support PHP 5 with Xdebug any more. It saves more than 5000 lines of code.

He shares some of the responses to the change (via Tweets) from the community ranging from full support to outcry over the change. He points out that the current version of Xdebug (2.5) will continue to operate on PHP 5 systems but when Xdebug 2.6 rolls around, the 2.5 branch will only receive bugfixes and no new features. You can find out about those upcoming features here.

tagged: xdebug debugging tool php7 php5 upgrade support

Link: https://derickrethans.nl/xdebug-php5.html

PHP 5: Active Support Ends. Now what?
Jan 02, 2017 @ 12:54:03

The final day of 2016 has come and gone and with it came the end of active support for the PHP 5.6 series of releases. This also marks the end of active support for anything in the PHP 5.x major release and pushing on with PHP 7. In this post to thePHP.cc blog Sebastian Bergmann talks about what this means for you and the tools you use.

The active support by the PHP project for PHP 5.6, the final release series of PHP 5, ends today. What is "active support"? And what does it mean for you? To answer this, you need to understand PHP's release process.

He starts with the release schedule and when it shifted from the "consensus based model" over to an official process, introducing more formality to the whole process (in 2012). He mentions two key terms to the process: "active support" and "security support". PHP 5.6 has moved past active support and is now in the the security support phase with only security fixes to be released from here on out. Sebastian then talks about what this means for your current code and, if you're still running on PHP 5.6, what you should do to come up to speed with PHP 7.x. He lists some of the projects that are moving into the world of PHP 7 only including PhpSpec 4.0, Laravel 5.5 and Symfony 4.

tagged: php5 active support end security php7 migration upgrade

Link: https://thephp.cc/news/2016/12/php-5-active-support-ends-now-what

Upgrading Your Linux Server to PHP 7.0
Dec 07, 2016 @ 11:47:25

The TutsPlus.com site has a new tutorial posted showing you how to upgrade your Linux server to run PHP 7.0, the latest major release of the PHP language.

PHP 7 was released last December. Once you've tested your code locally to run on it, it's time to upgrade your production server. Generally, I found that most of my sites run well on it.

However, I suspect that not many sites have upgraded yet. It's often safer and easier to stay on older releases. [...] But PHP 7 has now been out for nearly a year.

In today's episode, I'll walk you through my recommended approach to upgrading to PHP 7 on Ubuntu 14.x and resolving problems with PHPMyAdmin, which a lot of early upgraders ran into.

He starts by helping you identify any customizations that you might have related to PHP 5, specifically related to configuration options. He then provides the commands to remove PHP 5 packages from the system and add in the "ondrej/php" PPA for apt-get as the source for the PHP 7 packages. After a quick apt-get cleanup, he includes the commands to install the "php7" packages, enable a few extra modules and getting phpMyAdmin back up and in working order.

tagged: upgrade server php7 php5 ppa aptget phpmyadmin tutorial

Link: https://code.tutsplus.com/tutorials/upgrading-your-linux-server-to-php-7--cms-27583

Tumblr Engineering Blog:
PHP 7 at Tumblr
Nov 11, 2016 @ 13:07:07

The Tumblr Engineering blog has a new post with details about how they made the switch to PHP 7 in their previously PHP 5 codebase (and some of the things they learned along the way).

At Tumblr, we’re always looking for new ways to improve the performance of the site. This means things like adding caching to heavily used codepaths, testing out new CDN configurations, or upgrading underlying software.

Recently, in a cross-team effort, we upgraded our full web server fleet from PHP 5 to PHP 7. The whole upgrade was a fun project with some very cool results, so we wanted to share it with you.

They start off with the timeline of events, starting with the original hackday project out through the final PHP 7 deployment in production less than a year later. They cover some of the testing methods they employed during the transition and the impact of the update on their application on request latency, CPU load and memory usage. They wrap up the post talking about some of the PHP 7-specific things they made use of in their update including anonymous functions and scalar type hinting.

tagged: tumblr php7 update php5 hackday project testing performance

Link: https://engineering.tumblr.com/post/152998126990/php-7-at-tumblr

Chike Mgbemena:
Abstract Syntax Tree/Uniform Variable Syntax in PHP 7+
Nov 01, 2016 @ 11:57:01

Chike Mgbemena has a new post to his site looking at PHP 7 and the abstract syntax tree and uniform variable syntax changes that came along with it.

On my previous post (PHP 7 In-depth Look), I discussed in-depth about the features of PHP 7 (you can read it here if you have not). In this post, I am going to be talking about The Abstract Syntax Tree(AST)/Uniform Variable Syntax in PHP 7+.

PHP 7 introduced a new layer which is called the Abstract Syntax Tree(AST) which helps in decoupling the process of parsing from the pseudo-compile process. Note that this new layer does not have much impact on performance but it make the syntax uniform. Uniform variable syntax/abstract syntax tree aims to establish internally consistent variable syntax, references are accessed from left to right instead of right to left.

He goes on to talk about dereferencing, how it changed from the PHP 5 handling and what IIFEs have to do with it. Some sample code is included showing some of his points and how PHP 7 interprets things slightly different than PHP 7.

tagged: abstractsyntaxtree ast uniform variable syntax php7 php5

Link: http://chikemgbemena.com/2016/11/01/abstract-syntax-treeuniform-variable-syntax-in-php-7/

Freek Van der Herten:
Converting PHP 7 code to equivalent PHP 5 code
Apr 01, 2016 @ 09:50:56

Freek Van der Herten has a post to his site about another new library he's worked on (along with two others) to help convert PHP 7 code back to PHP 5 code - 7to5.

In the JavaScript world converting modern code to an older syntax is quite common. In the PHP world you don’t see that happen often. Symfony provides a few [polyfills](https://github.com/symfony/polyfill), but a full fledged conversion isn’t available. At the meetup of [our local PHP user group](http://www.meetup.com/phpantwerp/) [Jens Segers](https://twitter.com/jenssegers), [Hannes Van de Vreken](https://twitter.com/hannesvdvreken) and I were toying around with the idea of converting PHP 7 code to equivalent PHP 5 code automatically.

Today our little hobby project called 7to5 was tagged 1.0.0. You can view the repo on GitHub.

He starts by talking about what the library does to backport the code from PHP 7 to PHP 5 and how to install/use the command line tool. He then gets into things "behind the curtains" with a sample PHP 7 class and the resulting PHP 5 code. They made use of the PHP Parser tool for processing the PHP code provided. It does matching on certain element types and performs the token replacement. He gives examples of this with the null coalesce operator replacement and scalar type hinting.

tagged: convert php7 php5 code tool 7to5 introduction library

Link: https://murze.be/2016/03/converting-php-7-code-equivalent-php-5-code/

Toptal Blog:
Introduction To PHP 7: What's New And What's Gone
Mar 14, 2016 @ 12:04:12

The Toptal blog has a new post talking about PHP 7 including some of the new things it includes (and what's gone from previous versions of the language).

One of the most exciting events in 2015 in the PHP world was the release of PHP 7, 10 years on from the release of the last major version, PHP 5. With a major step forward, PHP 7 introduces plenty of new features and performance upgrades. [...] This guide should serve as a quick tour on what to expect if you plan on moving your existing applications, or building new ones, on top of PHP 7.

He starts with a topic quite a few people wondered about - "where did PHP 6 go?". Following this he gets into some of the performance boosts that PHP 7 brings with it and updates to the "syntactic sugar" it offers developers to make their lives easier. He then gets in to the new features in this version like:

  • Scalar Parameter Types & Return Type Hints
  • Engine Exceptions
  • Anonymous Classes
  • CSPRNG Functions
  • Unicode Codepoint Escape Syntax

He finishes off the article looking at the migration from PHP 5 to PHP 7 and highlights some of the potential compatibility issues that could pop up during the migration.

tagged: php7 introduction features compatibility overview language php5

Link: https://www.toptal.com/php/php-7-performance-features

Freek Van der Herten:
A modern backup solution for Laravel apps
Mar 09, 2016 @ 11:15:54

As Freek Van der Herten mentions in this post to his site the latest release of the Laravel backup package has been released - version 3 - with some major improvements over previous releases.

Today our team released a new major version of laravel-backup. It can backup the files and databases of your application to one or more external filesystems. It uses Laravel’s native cloud filesystem to do this. The package can also notify you via Slack and/or email when something goes wrong with your backups. We’ve also created a dedicated site with full documentation. In this blogpost we want to give you some background of why and how the package was created.

They start out with a bit of history about the package, talking about how they created it to fill their own needs and how its risen in popularity since its release. Following this the post talks about new features in version 3 including:

  • Taking backups
  • Cleaning up old backups
  • Monitoring the health of all backups
  • Sending notifications

There's also some brief mentions of other new features around event hooks and adding additional information to the backup file. There's a bit of code shared to show the quality/readbility of the code and links over to various resources on the documentation site as well. Finally they mention some information about the use of the package in PHP 5 (it has become PHP 7 focused with this release) and some of the alternatives that are out there.

tagged: backup laravel package php7 release improvement features history php5

Link: https://murze.be/2016/03/a-modern-backup-solution-for-laravel-apps/

PHP 5.5.33, 5.6.19 & 7.0.4 Released
Mar 04, 2016 @ 12:38:49

The latest releases of all major (and minor versions) of the PHP language have been released with several bugfixes including correcting a few security issues: 5.5.33, 5.6.19 and 7.0.4.

The PHP development team announces the immediate availability of PHP [5.5.33, 5.6.19 and 7.0.4]. This is a security release in which two security bugs were fixed. All PHP users are encouraged to upgrade to this version.

You can find out more information about what changes were made in these releases in the PHP 5 Changlog and PHP 7 Changelog along with references to the related bug information. As always, you can download these latest releases from the main PHP.net site or your favorite mirror linked from the main downloads page. Windows users can get the latest binaries from windows.php.net.

tagged: language release php5 php7 bugfix security issue

Link: http://php.net/downloads

Johannes Schlüter:
More on references
Feb 23, 2016 @ 10:48:31

Johannes Schlüter has continued his series of posts with this second part looking more at reference handling in PHP (how they're handled "behind the scenes" that is).

In a few different places I saw comments about my last blog post about references and performance where commentators noted that my example was pointless. Which of course is true and to some degree the point.

I read a lot of PHP code and from time to time I see people with a non-PHP background (or otherwise influenced) putting references everywhere they pass arrays or such in order to prevent copies. I knew this was a bad practice in PHP 5 and wanted to verify this in PHP 7.

In the post he talks about passing references to methods and how it can lead to less clarity in the resulting code. He also wonders about the situation when you don't actually want to modify the variable passed in and making copies (losing any performance gain). He suggests that using references should only come when you know exactly how the value will be used in the method, not casually or just for performance reasons.

tagged: references php5 clear code php7 copy

Link: http://schlueters.de/blog/archives/181-More-on-references.html