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.
Support
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
|
||
Description
|
Product Option
|
Licensed Program
|
Portable Application Solutions Environment (PASE)
|
33
|
5722SS1
|
Qshell
|
30
|
5722SS1
|
System Openness Includes
|
13
|
5722SS1
|
Digital Certificate Manager
|
34
|
5722SS1
|
IBM Portable Utilities for i5/OS
|
*base
|
5733SC1
|
OpenSSH, OpenSST, zlib
|
1
|
5733SC1
|
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:
Start: CALL
ZENDCORE/ZCCAPCS001
Stop: CALL
ZENDCORE/ZCCAPCE001
Restart: CALL
ZENDCORE/ZCCAPCR001
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
|
||
Extension
|
Description
|
Notes
|
db2
|
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:
CREATE TABLE FRUIT/APPLES (COLOR
CHARACTER (10 ) NOT NULL WITH DEFAULT, NAME CHARACTER (20 ) NOT NULL WITH
DEFAULT)
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.
|
Figure 9: Fruitserver.php contains one class, one function, and a few SOAP
commands.
Step 3: Create the client code, fruitclient.php (Figure
10).
|
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).
|
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
|
||
When
|
Product
|
Version
|
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.
|
GA
|
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.
|
GA
|
late August 2006
|
Zend Platform,
Zend's flagship product for the enterprise, with acceleration, caching,
performance monitoring, and Java Bridge. Cost to be announced.
|
GA
|
end of 2006
|
Zend Framework, which further
speeds application development with standard architecture.
|
still in discussion
|
then...?
|
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.
Resources
• 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:
LATEST COMMENTS
MC Press Online