PHP 8.1 Released for IBM i

PHP 8.1 and IBM i

Good news everyone! In cadence with the release of PHP 8.1 by PHP.net last week, companies running PHP on IBM i can now download PHP 8.1 for use with their own applications.

According to this briefing with IBM i’s Open Source Business Architect, Jesse Gorzinski, staying current with PHP is a best practice for many reasons—for security and security audits, to fix deprecated code before you dig a huge technical debt hole, to keep your PHP environment running smoothly, and so on.

I’ll cover how to access the IBM i version of PHP 8.1 later in this post. First, though, let’s survey our favorite enhancements in this new release. We’re a big fan of PHP’s own release notes, so we recommend that you read them.

Highlights of PHP 8.1

For a highlight reel of the biggest improvements, we like these:

  • Enumerations: Use enumerations instead of constants for easy validation. Enumerations can also have functions associated with them.
  • Fibers: While not directly relevant to an application programmer, fibers are the building blocks for libraries to provide simple concurrency.
  • Class improvements: New read-only properties can be initialized only by constructors; objects can now be used as the default value for a constructor, making nested attributes possible; final class constants prevent child class constants from being overwritten.
  • Better performance: The difference is more pronounced for object-oriented code, due to improvements in inheritance and name resolution.
  • PDO_ODBC fix: In this release, the PHP team has included a fix I submitted for PDO_ODBC that allows PDO::getAttribute() to return values for PDO::ATTR_SERVER_INFO and PDO::ATTR_SERVER_VERSION. (Previously, an exception occurred.)
  • Years of support: PHP 8.1 will receive security fixes till November 2024.

Areas to test with PHP 8.1

PHP tends to have great backwards compatibility between releases. However, some changes might be significant to your application:

  • $GLOBALS has been restricted for modifications.
  • PHP has been changing resource objects to classes, as they’re less clumsy to work with and more amenable to having methods.
  • The HTML entity functions now handle single quotes and substitutions.
  • MySQLi now defaults to exceptions for error handling.

How to access and install PHP 8.1 on IBM i

CommunityPlus+ PHP now includes PHP 8.1, so you can try it for yourself. Here’s how:

  • If you do not yet have CommunityPlus+ installed, access it here and select PHP 8.1 during installation.
  • If you’re already using CommunityPlus+, add the PHP 8.1 repository to your existing installation (email us if you forgot the password).

PRO TIP: To test PHP 8.1 in isolation from your live PHP applications, you can install it in a chroot. (See our tutorial on how to set up a chroot.)

Additional tips on moving to PHP 8.1

  1. For free help scoping your PHP upgrade project, schedule a complimentary PHP upgrade assessment with Alan.
  2. For ongoing, seamless PHP operation, consider trying our proactive PHP support. It includes quarterly tune-up sessions with free advice on configuration and upgrades, security bulletins, responsive troubleshooting, and expedited fixes.
1 reply
  1. Giles Sadler
    Giles Sadler says:

    Great work! Warning to people running WordPress though. There are some bits of wordpress that fallover at 8.1. New version of 8.1 compatible WP supposedly slated to role out at the end of Jan 22. I would leave upgrading PHP for WP users ’til a while after that..

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.