Thu, Jun
4 New Articles

Zend Brings PHP to IBM's i5/OS

Web Languages
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

PHP, the popular cross-platform Web development tool, shows great versatility. It offers power to the pro and simplicity to the novice. It runs on many hardware and software platforms, including Windows, Mac, UNIX, and System i. PHP offers other benefits as well:

  • Requires no licensing fees
  • Runs many blogs and content management systems
  • Can connect disparate systems with technologies such as SOAP
  • Is endorsed by IBM

With DB2 support, powerful extensions and commands, and an architecture built for the web, PHP brings modern functionality to System i, simplifying tedious tasks. I recently worked with an HTML "textarea" (large text box) and had to split the text into chunks of a maximum size, observing word breaks. A mundane, time-consuming programming job? No—with PHP's wordwrap function, I needed only one line of code.

Zend ("The PHP Company"), which coordinates PHP's open-source development process, provides software and services that help companies use PHP effectively. Zend and IBM have cooperated since 2004 to offer PHP-oriented products for IBM's servers and databases, especially DB2.

Programmers of All Levels

Even people without programming experience can use PHP. According to Michael Pinette, Zend's vice president of business development, an early Zend customer was a non-programmer psychiatrist who used PHP to provide online access to mental-health topics, reference material, and social-networking portals for specific disorders. While such newcomers can use PHP, the language has enough advanced features to satisfy experts who wish to write sophisticated object-oriented applications.

Zend's Added Value for System i

Zend is a great match for System i because it brings the priorities of the System i community—stability, trust, safety, easy administration—to PHP. For IBM, Zend provides reliable PHP distributions and value-added components. According to Andi Gutmans, Zend's co-founder and vice president of technology, the company performs rigorous testing on PHP, selecting the most stable, best-performing versions for release in Zend Core. The first generally available (GA) release of Zend Core will include version 5.1.4 of PHP, says Gutmans. Gutmans estimates a six-month lag between the appearance of an open-source version of PHP and its Core release, "so it's stable and bulletproof, and customers won't hit walls."

Gutmans says Zend intends to port all its products to System i, treating the platform's users as first-class citizens, with the full solutions that other platforms enjoy.


Zend users needing technical support can go to the Zend Support Center and obtain the first "support ticket"—continued help until a single problem is resolved—free. Subsequently, paid support is available at several levels, including 24x7 phone support. If a problem needs a collaborative resolution, Zend will work with IBM's engineers to solve it. In addition, free assistance may be requested at the Zend forums, with the usual delays and uncertainties inherent at volunteer help sites.

System Requirements

Zend Core requires i5/OS V5R4 or higher. Although IBM may eventually overcome technical hurdles to allow V5R3 support, this development is far from certain. System i users who want to try Zend in the near future would be wise to upgrade to V5R4, installing all relevant PTFs, especially the latest HTTP Server (Apache) PTF group.

Besides V5R4, users must install the following licensed programs:

Zend Core Required Licensed Programs
Product Option
Licensed Program
Portable Application Solutions Environment (PASE)
System Openness Includes
Digital Certificate Manager
IBM Portable Utilities for i5/OS
OpenSSH, OpenSST, zlib

How to Install Zend Core

After verifying the system requirements above, download Zend Core and Studio from Zend Network i5/OS page. Register as a Zend Network member to obtain access to Zend Core and Studio, discussion forums, support, and automatic software updates. When asked to select a "channel," click the link labeled "Zend Core," leading to a download page. From there, save the zip file to your hard drive. Extract the Zend Core files using an unzip tool such as ZipGenius. The extracted files include a save file, release notes, and a user guide.

For installation details, consult the release notes and user guide. Here are some additional tips (as of Version 1.3.1, the latest available at press time):

  • One "prerequisite" can be ignored. You do not need licensed program 5722ac3, Crypto Access Provider 128 bit. The functionality of this program has been absorbed into other programs.
  • The installation uses IFS directory /usr/local. Create /usr/local before installing Zend Core. Make sure it is a true directory, not a symbolic link to another directory. (Confirm with the command WRKLNK '/USR/LOCAL' and then option 8, "attributes.")
  • Sign on as QSECOFR for the installation process.

If any Web errors should occur, check for error messages in the following log files: /usr/local/Zend/apache2/logs/error_log .* or /usr/local/Zend/core/logs/php_error_log

Once you have installed Zend Core, the administration Web site will be available to you. The URL (by default) is http://www.myserver.com:8000/zendcore (myserver.com is any domain name assigned to your System i). Place your own PHP scripts in /www/zendcore/htdocs. They will run from http://www.myserver.com:89. Figures 1 and 2 show the Control Center and PHP Configuration pages.


Figure 1: Zend Core for i5/OS Control Center shows the status of PHP and the Web server. (Click images to enlarge.)


Figure 2: The Web-based PHP Configuration page is easier to read than old-fashioned PHP.INI files.

Installing Zend Studio

Download the appropriate version for you (Windows, Mac, or Linux) from the same page from which you downloaded Zend Core. The Windows version that I tried was a self-extracting executable file that installed easily.

Menus in 5250 Mode

Most of Zend Core's options are available on the Web-based administration interface. Some actions, though, can be run from a 5250 screen.

Main menu (shown in Figure 3): GO ZENDCORE/ZCMENU


Figure 3: The Zend Core 5250-based setup tool offers access to the Apache menu and a few other selections.

For direct access to the Apache menu: GO ZENDCORE/ZCAMENU

Administrators can control Zend Core's Apache server programmatically (for example, upon IPL) with these lines:

Power from Extensions

Extensions contain targeted bits of functionality. When compiled into PHP, they act as seamless parts of the language. Although anyone may write an extension and compile it into PHP, Zend has selected the best for inclusion in Zend Core, Gutmans says. Gutmans and his colleagues have included the most widely used extensions that meet their standards of quality, including, for example, ibm_db2 for optimized db2 access and gd for creating graphics dynamically.

Figure 4 shows the Extension Configuration page.


Figure 4: Extension Configuration allows extensions to be activated and configured.

At press time, Zend Core for i5/OS included the following extensions: bcmath, bz2, calendar, ctype, curl, db2, dom, exif, ftp, gd, tidy, gmp, ibm_db2, iconv, imap, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcntl, pcre, posix, session, shmop, simplexml, soap, sockets, spl, sqlite, standard, sysvmsg, sysvse, sysvshm, tokenizer, xml, xmlreader, xsl, zip, zlib, ming, and wddx.

Alternative to mail()

The first GA release of Zend Core will not support PHP's mail() command. System i does not have the "sendmail" program that mail() requires. Applications needing to send or receive email must use an alternative, such as the free PHPMailer class. Newcomers can get started quickly with the PHPMailer Tutorial.

Integration with Traditional i5/OS Objects

Generic, open-source distributions of PHP do not handle System i's special object types such as data areas, data queues, and message queues. Such distributions have no straightforward method to call i5/OS commands and programs written in RPG, CL, and COBOL. Zend Core is gradually filling this gap in the following ways:

  • Beta V2 (early July 2006) will have a "bridge" to RPG, CL, and other i5/OS native program objects.
  • GA (late July) will have further bridges to data queues and message queues.
  • Future releases may offer integration with other objects, such as data areas.

Database Access

Zend Core's PHP distribution has several extensions that enable users to connect to databases on System i and other platforms, as shown in the following table.

Database Extensions in Zend Core for i5/OS
DB2 unified ODBC driver
The db2 extension provides a native db2 driver, accessed with the generic ODBC interface.
ibm_db2 (recommended)
Native, optimized extension for DB2
IBM's DB2 and System i engineers collaborated to make a high-quality, well-performing extension. Zend further tested it for reliability.
PDO (not available)
PHP Data Objects
Not yet mature and stable enough for inclusion in Zend Core, PDO is an object-oriented, portable, generic interface to database drivers.
mysql, mysqli
MySQL database access
Although PHP works well with the MySQL extensions, Zend Core does not include MySQL server software. Users who want MySQL should download it using instructions such as these.

One easy way to get started with the ibm_db2 extension is to go to an example from Zend's "Developer Zone," copy it, and adapt it. The SOAP example later in this article also uses ibm_db2.

Zend Studio Is a Bonus That Speeds Development

Zend Studio Professional is a graphical development environment intended to speed development and improve code quality. System i customers are getting this excellent package free while others pay $240 list price.

Available for Windows, Mac, and UNIX clients, Studio is a dazzling productivity booster. Anyone still using a simple text editor is urged to try Studio.

Consider the following examples from the Zend Studio feature list. The 5.2.0 beta version was used.

Interactive debugger (Figure 5): Studio has a sophisticated debugger. While code runs, the debugger shows the function's output (text and HTML format), values of variables, the call stack, and more.


Figure 5: In the debug demo, the Debug Output pane shows the accumulation of HTML or text source as code runs.

Coding errors are uncovered by the "real time" syntax checker (Figure 6):


Figure 6: The syntax checker noticed that a parenthesis was missing.

The code analyzer (Figure 7) produces a detailed error log.


Figure 7: The code analyzer found an unused variable, indicating a potential error.

SQL Support can work with structures and data of many database types (Figure 8).


Figure 8: Studio's SQL facility shows MySQL data from a Mambo content management system.

Version and Source Code Control

Zend Studio includes built-in clients for the popular Concurrent Versions System (CVS) and Subversion (SVN) version control systems. Administrators can download and install the open-source server portions from the Web. SVN, according to Gutmans, is superior to CVS and is adequate for teams of up to 10 developers.

Large teams might prefer a more robust version control system. Under discussion, Gutmans says, is the possibility that Zend will work with Eclipse and enterprise-grade version control such as IBM Rational ClearCase for more complex development environments.

Zend Studio Simplifies SOAP

Simple Object Access Protocol (SOAP) is an XML-based format that applications can use for exchanging data, primarily via HTTP. When two applications communicate, the data provider is called the "SOAP server." The data consumer is called the "SOAP client." How does the client know what services are offered by the server? A Web Services Description Language (WSDL) file defines the server's input and output. Zend Studio, with its ability to generate WSDL files, greatly speeds the preparation of SOAP services.

When I ran a quick personal test of PHP's SOAP extension and Zend Server's WSDL generator, everything worked easily. The example below, adapted from a sample by Zend's Shahar Evron, includes a server script (fruitserver.php) and a client script (fruitclient.php).

Step 1: Create table with data to retrieve.

From STRSQL on a 5250 terminal, I created a table and gave it two records of test data:

INSERT INTO fruit/apples (color, name) VALUES('red', 'Red Delicious')
INSERT INTO fruit/apples (color, name) VALUES('green', 'Granny Smith') )

Step 2: Create the server code, fruitserver.php (Figure 9).

The "at" signs (@) are part of phpDocumentor format, which helps generate WSDL markup. Note that fruitserver.php retrieves System i data using the ibm_db2 extension.

 * Fruitserver.php
 * A sample SOAP server using a WSDL file generated with Zend Studio

 * This class describes a fruit-fact provider: It provides information about common fruits. 

It gets the information from an IBM System i DB2 database.
 * Objects of this class be used internally in your application
 * as well as exposed as a SOAP service.
class fruitfacts
       * Return the apple's name based on color.
       * @param string $color
       * @return string
      public function appleNameFromColor($color)
            $applename = ""; // intialize

            // connect to System i DB2 database using default database 

name, user, password
            if (! $conn) {
               return db2_conn_errormsg();
                  } else {
            // query our System i DB2 database
            $sql="select name from fruit.apples where color=? ";
            $stmt = db2_prepare($conn, $sql);
            $result = db2_execute($stmt, array($color));

            $row = db2_fetch_both($stmt);
            if ($row) {
               $applename = $row['NAME'];
            } // the else of connection OK

            // color not found
            if (! $applename) {
               $applename = "unknown apple";
            return $applename;


// Set up the SOAP server, specifying wsdl file
$server = new SoapServer('http://www.myserver.com:89/soaptest/fruitfacts.wsdl');

// Handle SOAP requests

Figure 9: Fruitserver.php contains one class, one function, and a few SOAP commands.

Step 3: Create the client code, fruitclient.php (Figure 10).



 * Fruitclient.php
 * This is a sample script that uses the Fruitserver SOAP service. 
 * It demonstrates how to set up SOAP clients using WSDL files.

// Try to set up the SOAP client and get the data
try {
      // WSDL files can be read directly from the web!
      $client = new 


      $color = array("red","green","purple");
      $fruitname = array(null,null,null);

      // pass in three colors, get three fruit names from the server
      $fruitname[0] = $client->appleNameFromColor($color[0]);
      $fruitname[1] = $client->appleNameFromColor($color[1]);
      $fruitname[2] = $client->appleNameFromColor($color[2]);

} catch (SoapFault $fault) {
      $errorMsg = "SOAP error {$fault->faultcode}: {$fault->faultstring}";

  SOAP Example


 padding: 2px; font-family: fixed; font-size: 9pt;">

      SOAP example: get apple name by color 
            This SOAP client passes a color to a remote SOAP server. 

The server returns a variety of apple matching the color. 
      Apple colors and varieties:


Figure 10: Fruitclient.php uses a few SOAP commands (near the top) to get data from fruitserver.php.

Step 4: Run the WSDL Generator Wizard from the Tools menu, as shown in Figures 11 to 17.


Figure 11: The WSDL Generator Wizard creates a configuration.


Figure 12: Select PHP files to analyze.


Figure 13: Point the Wizard to fruitserver.php, where our service function resides.


Figure 14: The WSDL generator reports its intention before creating the WSDL.


Figure 15: The WSDL file was created.

I was glad I didn't have to create fruitfacts.wsdl by hand (Figure 16).






                  This class describes a fruit-fact provider: It provides 

information about common fruits.
                        Return the apple's name based on color.









Figure 16: Fruitfacts.wsdl defines the services offered by fruitserver.php.

Now we run our SOAP client in a browser. It accesses WSDL and the SOAP server, retrieving our apple varieties (Figure 17).


Figure 17: The client, the server, and the WSDL file work together.

Probable Schedule of Zend Releases for i5/OS

According to Andi Gutmans and Michael Pinette, Zend's releases for System i will be as follows:

Zend's Releases for System i
early July 2006
Zend Core, Zend Studio
Version 2 beta
end of July 2006
Zend Core, Zend Studio using PHP V5.1.4. Free for System i users.
3rd quarter 2006
Zend Guard to encode PHP. Good for security and retaining intellectual property. Useful for independent software vendors (ISVs). Cost to be announced.
late August 2006
Zend Platform, Zend's flagship product for the enterprise, with acceleration, caching, performance monitoring, and Java Bridge. Cost to be announced.
end of 2006
Zend Framework, which further speeds application development with standard architecture.
still in discussion
Watch the Zend for i5/OS forums for news

Figure 19: Zend is steadily providing all its products to IBM System i.

A New Approach to System i Web Development

In porting PHP to System i, IBM and Zend have given the community a powerful, low-risk approach to Web development. Developers who use PHP strengthen the platform while mastering technology that can run almost anywhere. PHP re-energizes System i with advanced capabilities for the Web that are easy to use. The advantages of System i—reliability, virtualization, scalability—remain.


Zend for i5/OS
Zend for i5/OS Discussion Forums (Core and Studio at this time)
Zend Forums for all platforms and products

•"IBM DB2 Universal Database, Cloudscape, and Apache Derby" by Dan Scott (PDF)

Zend Developer Zone
Zend Framework (currently in preview but reportedly stable and worth trying)

• Charts and Graphs in PHP: PHP/SWF Charts, JpGraph, PHP SOAP Extension

Alan Seiden is a consultant and developer at a northern New Jersey IT firm, where he enjoys his role as a creative software catalyst for clients. Alan is vice president of the New York City Usability Professionals Association. Email: This email address is being protected from spambots. You need JavaScript enabled to view it..

Alan Seiden
  Alan Seiden founded Seiden Group to help IBM i shops design and implement high-performance web and mobile applications using PHP, DB2, RPG business logic and Zend Framework best practices. Alan and his team work closely with some of the best minds at both Zend and IBM on behalf of their clients.With a passion for open source and community, Alan co-developed the popular PHP Toolkit with IBM. He was one of the first Zend Framework certified engineers; co-founder of the NYC Zend Framework Meetup; charter member of IBM/COMMON's PHP Advisory Board; and a consultant for IBM's manual PHP: Zend Core for i5/OS. An award-winning speaker, Alan has been called "the performance guru of PHP on IBM i." He shares his expertise regularly at conferences and user groups such COMMON, ZendCon, the RPG & DB2 Summit, OMNI, the Northeast Users Group Conference, OCEAN and WMCPA. He also mentors other developers within the Club Seiden forum.In his spare time, Alan plays the trombone and studies and teaches the Feldenkrais Method® of Somatic Education.Subscribe to Alan’s monthly newsletter PHP on IBM i Tips.  Follow Alan on Twitter: @alanseiden and LinkedIn: www.linkedin.com/in/alanseidenMore on Alan


Support MC Press Online

$0.00 Raised:

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: