simon_bisson
Contributor

The end of the line for PHP on Windows

analysis
Jul 14, 20206 mins
Microsoft .NETMicrosoft AzurePHP

Microsoft will no longer build new releases of PHP for Windows. What does the Windows Web application development future look like?

end-beginning signs point in opposite directions / start-finish / stages / order / sequencing
Credit: Gajus / Getty Images

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.

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.

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.

ASP.NET Core is a cross-platform environment that uses server-side .NET code to deliver HTML and JavaScript components. Building on the portable .NET Core runtime, ASP.NET Core’s Razor syntax offers declarative programming techniques similar to PHP. However, the big difference comes when you use it in conjunction with the server-side Blazor programming model.

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.

The recent launch of Azure Static Web Apps as part of Azure App Services brought a new way of creating and using Web content to Azure and Windows. By building sites locally using Visual Studio Code and hosting content in GitHub, a custom GitHub action deploys updated content to Azure. Sites are built using HTML, client-side JavaScript, and API connections to databases and other services.

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.

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.

simon_bisson
Contributor

Author of InfoWorld's Enterprise Microsoft blog, Simon BIsson prefers to think of "career" as a verb rather than a noun, having worked in academic and telecoms research, as well as having been the CTO of a startup, running the technical side of UK Online (the first national ISP with content as well as connections), before moving into consultancy and technology strategy. He’s built plenty of large-scale web applications, designed architectures for multi-terabyte online image stores, implemented B2B information hubs, and come up with next generation mobile network architectures and knowledge management solutions. In between doing all that, he’s been a freelance journalist since the early days of the web and writes about everything from enterprise architecture down to gadgets.

More from this author