The end of the line(life) for PHP on Windows
Microsoft will no longer build new releases of PHP for Windows. What does the Windows Web application development future look like?
PHP may have been around for a while, but it’s still an important Web development tool. Building on a declarative model of programming, PHP extends the familiar HTML syntax with additional commands and functions, adding in-line programming and extensions to your Web content. That model has made it an important part of many content management systems, providing a framework for managing database-delivered content and formatting pages using dynamic templates.
The future of PHP on Windows
Many of those CMSes run inside corporate firewalls, hosting intranets and internal collaboration tools. So it’s not surprising to see that the official Windows builds of PHP come from Microsoft, as one of its longest-running open source projects.
[ Also on InfoWorld: Microsoft .NET 5: What the merger of .NET Framework and .NET Core means for developers ]
But all good things come to an end, and Microsoft recently announced that it wouldn’t produce an official build of PHP 8 for Windows. Until now it’s been delivering Windows releases as binaries and source code on windows.php.net for IIS and other Windows Web servers. However, that will stop in the future, as the team delivering Windows PHP builds moves on to other projects as PHP 7 goes through its support lifecycle.
What does this policy change suggest for the future of PHP on Windows? And, more importantly, what are the alternatives if you want to take the opportunity to change the way you work?
Yes, there is a future
First, and most crucial, PHP for Windows will not disappear. It’s very clear that there’s more than enough demand for someone to continue building and distributing a Windows version of PHP beyond PHP 7. Microsoft won’t directly contribute resources and servers for the builds, but more than likely, it will donate licenses and servers to the PHP project to ensure that, at the very least, a Windows build will come out of the automated PHP CI/CD (continuous integration/continuous delivery) process.
It’ll be up to the PHP team to develop a set of Windows skills to ensure that the right tests are being run and that code is optimized correctly, by ensuring that the right build settings are used in Visual Studio. Although that shouldn’t be too hard, it’s not the same as having dedicated resources from one of the largest software companies in the world.
Alternatively, there are other Windows versions of PHP, built by a mix of third-party companies with their own PHP tools and from volunteers building from the open source codebase. If you want support, then you should probably choose a commercial PHP version, whereas open builds are ideal for putting together a Windows PHP development environment.
Using WSL for PHP development
If you’re looking for alternatives, Microsoft’s own Azure App Service cloud-hosted application platform supports PHP, although here it’s running on Linux, not on Windows. If you’re building code for this, you’re likely to want a Linux version of PHP at the heart of your development process, targeting it with the remote workspace tools in Visual Studio Code. There are many different PHP extensions for Code, from IntelliSense support to debugging and code formatting tools.
Installing PHP in WSL (Windows Subsystem for Linux) is easy enough, with all the dependencies you need installed via your chosen package manager. Installing PHP in an Ubuntu WSL instance will install and configure the Apache Web server, so you can quickly go from writing and testing code to running it on a production Web server. Installation takes a couple of minutes, with everything ready to run inside the Windows Terminal and accessible from Visual Studio Code running inside Windows. It doesn’t matter if you’re using WSL 1 or WSL 2, you get much the same experience with either version.
[ Also on InfoWorld: What’s new in Microsoft .NET 5? ]
With a Linux PHP instance running on your development machine you’re now able to build a PHP application and test it before deploying it to Azure App Services or to a hosted Web server. If you’re using WSL 2, this new development model can be used with the latest releases of Docker Containers, using your development PC to build code in WSL and then package it as a container for easier deployment to servers, either in your network, a hosting service, or the public cloud.
Using PHP on Linux via WSL is likely to be the least disruptive option for PHP development on Windows, but an alternative approach might be to work with a more modern Web development model. You’ve got a lot of choices: either remain in the Microsoft ecosystem using ASP.NET or move to a cross-platform model based on static site development using approaches such as Jamstack.
New development models: .NET Blazor and Azure Static Web Apps
One thing is clear: the declarative Web application development model used by PHP isn’t going away. A plausible argument for the end of official Microsoft support for PHP is that newer Microsoft technologies can give you similar development options, while using fewer resources and still working cross platform, and with a roadmap that supports newer Web technologies.
With a focus on single-page Web applications, Blazor Server executes ASP.NET code on your Web server, compiling content into pre-rendered Web components with a Signal R connection between browser content and back-end services. This approach has the advantage of requiring relatively little bandwidth, at the expense of some latency with a round-trip connection between server and browser needed for each interaction. Pre-rendering content in this way can help users feel that an application is more responsive, with interactions refreshing the UI components.
Like Blazor and PHP, Jamstack takes a template-driven approach to site design, though it’s less suited for traditional CMSes and more for file-based content that can be distributed through content delivery networks, using them to cache content closer to your users. You can build a content-based Azure Static Web Apps site using Jamstack techniques, but you have to be prepared to rebuild the entire site every time you publish any new content.
[ Also on InfoWorld: What is Jamstack? The static website revolution upending web development ]
Microsoft’s end of support for its own build of PHP isn’t a disaster. It’s a sign that Redmond’s priorities have changed; technologies such as WSL and Azure-hosted Linux offer alternate paths to building and running PHP code.
It’s also a sign that other, more modern approaches to Web application development may be more closely aligned with Microsoft’s current cloud-centric path, building on .NET and on modern application development techniques. Whatever you decide to do, you have plenty of options.