- Bypassing a Slow Composer Repository
- Slow Composer Followup
- Getting Started with PHP Composer and Magento
- PHP: The Right Way; A Review
- PSR and Code Style Guidelines
- Sellvana: Developer’s Alpha Review
- PHP Primer: Type Hints
- PHP Primer: Namespaces
- PHP Primer: Interfaces
- Design Patterns, PHP, and Magento
- PHP-FPM and File Permissions
- Why did the Elephant join the Guild?
In the past — three? four? let’s call it n — years, there’s been a lot written about PHP’s renaissance. The PSR standard(s), Composer’s day job as package/dependency manager, Composer’s night job as a simple standard PHP bootstrap, PHP’s asymptotic crawl towards a “types mandatory” enviornment, and a stable FastCGI server (PHP-FPM) have all made PHP a much more attractive choice for programmers, developers, devopserators, managers, and enterprises who need/expect/have-to-sell a programming enviornment’s features as being a certain way.
While we’re all better off for it, there have been some unintended consequences. The biggest one is a complexity growth curve that looks like it might be exponential.
PHP Circa 2007
Here’s an example: What does it take to get a modern PHP enviornment up and running?
Ten years ago, all Apple computers shipped with an Apache web server and a relatively current version of PHP. This meant with the click of a few buttons users could be up and running with a PHP enviornment. If you wanted MySQL it was just an installer away. If you owned a Windows computer you didn’t have anything built-in, but there was a healthy ecosystem of “WAMP” installers — (W)indows, (A)pache, (M)ySQL, (P)HP. All you needed to do was download an installer and you’d have an enviornment ready to run PHP. Back on the Mac, if the stock enviornment didn’t do it for you there were “MAMP” installers that did similar things. There were also long standing projects like php-osx.liip.ch (then run out of entropy.ch by the incomparable Marc Liyanage).
This put PHP within the reach of millions of potential new programmers. If you owned a computer and could follow along with some easy online instructions, you’d be writing PHP the same day.
All these projects still exist — but they’re starting to fray on the edges. Things like less-than-timely upgrades to SSL, or the continued reliance on good-old-fashioned-just-works
mod_php. Even when a project like php-osx.liip.ch stays up to date, their FastCGI setups don’t work out of the box.
Most worryingly — some modern PHP platforms are starting to leave these old installers behind. I’ve been told in more than one GitHub thread to abandon one particular PHP distribution in favor of another.
Running PHP in 2017
There are, of course, options for folks who want to run a modern PHP stack. The caveat is these are tools for professionals. They require either a knowledge of computers that go beyond the average user, a tolerance for combining half-broken systems into a coherent whole, or both.
Take a look at this Stack Exchange post for getting a PHP-FPM enviornment up and running on OS X/MacOS. It’s awesome that a few leaders can gently prod their community into producing a resource like this, but consider the steps themselves
brewto install — Apache or nginx?
brewto install PHP
- Use instructions from a random gist, maybe outdated, to do this
- Edit the web server configuration file manually
- Edit a PHP-FPM configuration file manually
- Assume an understanding of FastCGI’s two daemon model
Next, consider the complexities that exist for folks running a Windows environments — Vagrant and Docker start simple but ramp up quickly. Heck, there’s a UTF-8 bug for the most popular
apt-get PPA for PHP 7 that can trip up even an experienced programmer. Open source projects with starter
Vagrantfiles or docker recipes exist, but quickly fall out of date.
Compare this with the world 10 years ago — double click an installer or toggle a switch in your settings. The complexity has ramped up several fold, and we haven’t even gotten to Composer or finding an IDE that can tame PHP’s brave new types-visible world.
Professionals will deal with this — but PHP is slowly becoming an inaccessible technology for the average computer user. As a professional, I’ve been delighted by PHP’s maturing tooling, but PHP’s secret weapon has always been letting that average computer user get started.
PHP doesn’t need to fix this — I’ve seen programming environments far less accessible find their niche. However, if PHP wants to move from its renaissance into its enlightenment, we should take a hard look at the people we’re leaving behind in the name of modernity or fake-elitism. Whether it’s for the romantic idea that anyone should be able to use a computer to write a program, or the hardened business logic that wants a user base large enough to treat as a market, turning PHP into a technocratic guild feels like the least renaissance-y thing possible.