How to Upgrade Zend Framework 1 to PHP 7.4 or 8.x

UPDATED SEPTEMBER 15, 2022

Zend Framework

For security, performance, and developer productivity, we encourage PHP users to upgrade to current versions of  PHP.

What gets in the way of upgrading PHP? Often, it’s an old framework release, such as Zend Framework 1 (ZF1), which reached end of life in 2016. This article will show an easy way to upgrade PHP, even with ZF1 applications.

Migrating from ZF1 to newer frameworks, such as Laminas Mezzio, Laravel, or Slim, as recommended in a previous blog post, can take time. While framework upgrades are essential, we would not want ZF1 usage to impede anyone from updating PHP.

To allow ZF1 applications to be easily updated to new PHP releases, we sponsor a project called ZF1-Future: Original Zend Framework Reborn and bundle it with CommunityPlus+ PHP.

ZF1-Future

ZF1-Future is a “fork” of ZF1 that has been updated for modern PHP versions, through PHP 8.x, while maintaining compatibility back to PHP 7.1. In addition to compatibility with modern PHP, it includes some security updates, such as updated TLS encryption support, and other enhancements.

We provide ZF1-Future in an RPM package called php-zendframework1. It gets installed automatically with CommunityPlus+ PHP with the wildcard command yum install "php-*". ZF1-Future can also be installed or removed individually using its package name, php-zendframework1.

One of our clients has stated:

This has provided so much value to me. I cannot thank you enough for making this available. While I like Laravel, and will start new projects from there, I could not possibly have migrated everything in time. Instead, I can keep using the same code I have and just swap out the Zend library.

Brilliant!! Thank you, thank you, thank you!

Where does ZF1-Future get installed and how do I use it?

The RPM installer will place all files into /QOpenSys/pkgs/lib/php/ZF1/library/Zend. Because CommunityPlus+ PHP installations include lib/php/ZF1/library in their PHP include path, ZF1 applications will automatically run ZF1 from this directory (unless they use a hard-coded path).  If you don’t have this include path, you can append /QOpenSys/pkgs/lib/php/ZF1/library to your include path in php.ini.

For more information on ZF1-Future, see the ZF1-Future project page.

3 replies
    • Alan Seiden
      Alan Seiden says:

      Marcus, yes, it should work for later PHP versions for the most part already. I’ll update the article to say PHP 8 generally rather than 8.1 specifically. Also, we will work to get the readme for the project updated to be clearer. Please try your application with PHP 8.2 or 8.3 and let us know in the ZF1-Future repo issues if you run into any problems.

      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

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