What’s New on PHP? Seiden Delivers the Goods
October 23, 2024 Alex Woodie
PHP has been around so long on the IBM i server that it’s practically a legacy technology at this point (not that that’s a bad thing). But if you haven’t looked at PHP lately, you might be surprised at what’s going on with the newer releases. PHP guru Alan Seiden recently brought us up to speed with the Web development language with a webinar sponsored by TUG.
Seiden has been involved with PHP on IBM i for about 20 years. He was playing around with the open source language even before IBM and Zend worked together to bring the first official distribution of PHP to IBM i. That gives him a unique perspective on how the language has evolved, both on IBM i and off it.
As the owner of Seiden Group, he’s helped implement the language and runtime at innumerable customers and has submitted bug fixes that have been adopted by the global PHP community. And through his firm, Seiden even offers a distribution of the PHP runtime for IBM i, called Seiden PHP+, which is one of only two IBM i distributions of PHP, with the other being from Zend (now owned by Perforce).
Seiden recently presented a webinar through the Toronto User Group for Power Systems (TUG) on the latest enhancements to PHP, as well as changes to the collection of software that allow it integrate so well with IBM i.
If you haven’t paid much attention to the development of PHP on IBM i over the years, you’re probably not alone. But you may need to revisit your previous opinions about the language and how it runs, on IBM i or other servers.
“There’s not that much publicity about PHP anymore,” Seiden said during the TUG webinar. “You hear about Node, about cutting-edge stuff, and then Python is very well known. But that’s in a way it’s because PHP is so reliable now. The problems have mainly been solved so that it’s going to work well.”
Seiden Group provides technical services for Python and Node.js, in addition to PHP, and Seiden has good things to say about those languages. They have their place on the IBM i platform, he says. But at the same time, PHP has strengths that Node.js and Python can’t match, he said.
“Yesterday somebody asked me about the different languages. Does Python work well on IBM i? Does PHP work well?” Seiden said. “I said, PHP definitely is very solid and Python is good as long as you stay within certain kinds of parameters.”
PHP’s superpower is that it was developed from the beginning to be a language for developing Web applications. Python, by comparison, is a generic scripting language, while Node.js was created to enable Web style development outside of the Web browser.
“[PHP] wasn’t meant to be pure or perfect in any way. It was meant to be a very practical tool for web development and now API development,” Seiden said. “It comes with everything you need built in. You don’t have to be an expert on installing components and deciding which packages and modules you want, whereas those are strengths of Python and Node. . . With PHP, you don’t have to do that as much. The main extensions are built in. It’s pretty forgiving.”
Over the years, PHP has gotten considerably faster, Seiden said. Some of that is from the move from 32-bits to 64-bits, which allows PHP applications to use more memory. But there are lots of other changes that have tightened up the PHP code base and have contributed to performance increases, he said.
“Each new version of PHP gets faster and better,” he said. “Each one also now is getting more strict, meaning they don’t want you to do bad old things anymore. They don’t want you to use undefined variables anymore.”
Installing IBM i-specific components, such as the ODBC driver, is much easier now thanks to Yum and RPM, Seiden said. Prior to 2018, users would have had to navigate IBM websites, download the right piece of licensed code, and then install it. That whole process now is streamlined thanks to the Yum and RPM command line tools. For those who prefer a graphical environment, they can download PHP and other open-source products using Access Client Solutions (ACS).
“It’s good that things became so easy now, because it’s more important than ever to keep these technologies up to date for bug fixes and security fixes,” Seiden said. “It moves faster and this helps you. It’s so easy from a command line now.”
As Seiden mentioned, the pace of evolution in PHP is accelerating, and older features are being deprecated. The PHP community is still releasing one major release every November (the next release, PHP 8.4, is due out next month).
But one difference is that customers now have the option to hold onto older releases just a little longer, Seiden said. For example, the PHP community recently moved to provide full support of a release of PHP — including monthly bug fixes and security fixes–for a full two years after its initial release.
“It used to be one year and that was recently increased to two, so that’s something new and exciting,” Seiden said. “We get a second year of those security fixes, but only the critical ones. So after two years you don’t get a monthly update anymore. After four years, there’s no update at all.”
Customers who are running PHP 8.1 got a little bit of a reprieve, as it was originally scheduled to reach end-of-life at the end of 2024, but was given another year of life until December 1 2025. However, that doesn’t mean that IBM i shops running 8.1 shouldn’t make their move to a newer release, Seiden said.
“We always recommend you go to the recent version,” he said in the TUG webinar. “By the time a version of PHP comes out, it’s pretty good. It’s been already in an alpha release or a beta release and been tested in the community, so it’s not necessary to wait a long, long, long time before putting a PHP release in.”
So, what version of PHP should IBM i shops be using? As Seiden pointed out, PHP 5.6 was a very popular release. It debuted more than 10 years ago, and has been widely adopted in the IBM i community. However, it hasn’t been supported since 2018. Like i5/OS V5R4, which IBM eventually ended support for in 2013, it’s time to move on.
“Which version is best?” Seiden said. “Version seven and eight gradually became more strict and performance improvements came. [Version] 8.1 is really the minimum now and then 8.2 and 8.3 are the best ones.”
PHP version 7.0, which debuted in 2015, started reining in some of the old practices that could lead to issues, like allowing undefined variables and indexes. As Seiden points out, version 7 added the “null coalescing operator,” which allowed user to specify a default value for null or otherwise undefined variables and indexes. These notices become warnings in PHP version 8, and will lead to errors in PHP 9 (whenever that comes out).
Another relatively new feature in PHP is a tool called rector that shows the user the differences between their old code and their new code. “When you run it, it actually makes these changes for you,” Seiden said. “You can see down below, there’s the red with the minus sign and green with the plus sign. It took out the old syntax and added the new syntax that’s shorter. And it does this for you on your code base. And it’s continually improving.”
Some of the newfound strictness in PHP started in version 8.1, which debuted in November 2021 and implemented more restrictions on string types. “Say you were looking at a string, like use the string length of function,” Seiden said. “If you pass a null into that, it gives you a deprecation notice now, like oh, you shouldn’t be doing that. You shouldn’t be passing a null as a string. So PHP was always good at automatically converting different data types. So that’s starting to get a little strict.”
PHP 8.2, which debuted in November 2022, brought additional performance enhancements, some of which Seiden Group can take credit for. The company identified a bug in the ODBC driver, and it worked with the community to get it fixed. That not only bolstered performance with IBM i, it also helped to foster a sense of community empowerment, he said.
“Now we realize when something doesn’t work, there’s a reason,” Seiden said. “There’s actually a bug somewhere and we can fix it. It’s a really different feeling knowing you can fix the bug rather than, well, that doesn’t work, don’t try it.”
One compelling feature in PHP version 8.3, which came out in November of 2023, is support for a JSON validate function. This feature is very useful for API development, which is a trend among IBM i developers, Seiden said. “This is a way of checking that the JSON is valid before you go and parse the whole thing, so it can be a performance improvement to check that,” he said.
PHP 8.3 also brings support for Boolean data type in the Db2 for i database connector. That requires users to be using IBM i 7.5, of course, which introduces the support for Boolean. That is being put to good use in PHP, Seiden said.
PHP performance in general has made big improvements over the years, according to Seiden. “The move from 5.6 to 7 was a giant leap forward in performance,” he said. “Each release improves a little bit. Like compound interest–you keep doing it over the years and it adds up.
Someone actually complained to Seiden that PHP on IBM i felt too fast. “Some software applications actually put a slowdown in on purpose because otherwise people think it didn’t do anything,” he said. “So keep that in mind.”
In addition to performance improvements, security has been gradually improved over the years, Seiden said. The password hash function, for instance, ensures that passwords are kept secure and are using the latest encryption algorithm when sent over the wire with TLS. Seiden Group also worked with the PHP community to make a change in PHP version 8.2 to fix an error with passwords that contained semi-colons.
While security has been improved in PHP over the years, users must stay up to date on other aspects of their system, such as the HTTP Server (the one powered by Apache), to ensure that their entire PHP Web applications are secure. There are known vulnerabilities that PHP users should know about. Seiden has written several articles that give IBM i shops tips on how to keep PHP secure.
RELATED STORIES
PHP Is Here To Stay: PHP 8 And Beyond
Innovating And Thriving with IBM i
PHP Decisions Loom as Original Distro Reaches End of Life
Seiden really excellent PHP distro. And they know their stuff.
Some don’t realize that PHP is also an excellent general non-web batch utility, like calling from ILE, thanks to a lot of included functionalities. i.e. We use to receive files via FTPS/FTPS from remote, notify a message queue and log to db2 any transfer.
Paired with the IBMi toolkit and PASE ODBC, it is also pretty performant and flexible in the possibilities (i.e. image generation / manipulation etc.).
It has become a pretty robust language, with all the needed formal bells and whistles coupled a familiar programming model (compared say to the callback galore nonsense of say a fashionable node.js).