June 2013

PHP

May 22, 2013

The IBM i 25th anniversary celebration continues with another chapter: PHP. In this blog post Mike Pavlak, solution consultant for Zend, explains how this unlikely pairing became so wildly popular. Mike helps IBM i customers worldwide explore PHP as a business solution. Read his story, and then join the conversation on facebook.

PHP Hypertext Preprocessor entered the IBM midrange scene in 2005 as the result of several IBM advisory groups’ requests for an easy to use Web scripting language. Zend and IBM worked very closely together to deliver an integrated, optimized and supported PHP environment for IBM i.

The initial goal was to provide a simplified development solution for Web applications that would run quickly, securely and natively on IBM i. Today, we see businesses and ISVs developing business-critical applications in PHP to run on IBM i. Thousands of companies around the world now run PHP Web applications that talk to directly to DB2 as well as integrating with programs written in RPG and COBOL. A couple of unplanned side effects of introducing PHP, however, were to make thousands of open-source applications readily available on IBM i, plus to provide IBM i developers access to a new and very valuable source of OPC (Other Peoples Code). It’s not only a great source of new apps and OPC, it’s also an approach to application modernization that is a near perfect fit for the IBM i community.

Many popular open-source PHP-based applications, like SugarCRM, Drupal and Wordpress, provide working solutions that install in minutes and run natively on IBM i. They are tremendous examples of how to create modern Web applications that–like RPG apps–let you focus less on the technology and more on the business process.

PHP as an open-source language is built by the community for the community. This democratic method of language evolution means that many of the functions that make up the language started life as small examples someone developed for themselves and decided to share. These examples of OPC begin the contagious value proposition of developing business solutions in PHP on IBM i. It also allows developers to focus less on the language and more on the business application of the language. There is simply no computer language on the planet that boasts such a passionate community of developers constantly offering up their code examples for public consumption. Literally billions of lines of PHP-based OPC are available for IBM i developers to choose from on sites like sourceforge, hotscripts.com, phpfreaks, phpclasses.org and many more.

Just like with RPG, a relatively new PHP developer can become productive very quickly. One reason for that speed is that object-oriented (OO) development is optional. Many agree that OO development styles are important for solid application modernization. But when you can put the OO model to the side and focus on simple language syntax and business processes, you have a formula that’s familiar to many RPG developers. All of the energy that goes into developing procedural PHP applications fuels the long-term development using all of the many features of PHP in the OO paradigm and developers can “modernize on their own terms.” This brings tremendous value to organizations where the needs are great but the resources may be few. Developers can pick up as much about PHP as they need through the daily requirements of interactive Web page building. Starting with simple data inquiry applications is a great launching pad and, as the skills grow, the addition of updates and then framework based applications begins to take hold.

In addition to our close cooperation with IBM on PHP, Zend creates products that enable developers to deliver high-quality PHP code faster to production, and help system administrators ensure high performance and availability. Our Zend Studio for IBM i is a professional grade Integrated Development Environment for developing PHP applications. In addition, Zend Server for IBM i contains a complete PHP runtime environment, with additional performance optimization, monitoring, root cause analysis, and more.

July 11, 2012

This PowerUp blog post was written by Laura Ubelhor, who owns and operates Consultech Services, Inc., a Rochester, Mich.-based consulting company established in 1992. Laura has extensive hands-on experience specializing in IBM i application technologies and working with a long list of clients in a variety of businesses.

When pondering how to encourage and help local i colleagues enhance and broaden skills and how to enthuse local i colleagues to participate in user group activities, the thought came to mind to use a hands-on activity to provide LUG members an opportunity to learn new and current skills. It was an idea that I knew would require time commitment and funding to put into action. I was pleased to see a grant offered by the Maxava iFoundation and filled out the application. My local user group, SEMIUG, received the grant and the plan was put into action.

The objectives included providing a means for LUG members to learn new skills through a hands-on experience, working on a live project, to encourage LUG organizations to use new technology and to drum up enthusiasm to participate within LUG activities. The starting point was aligning a box to complete the hands-on activity. Fortunately Larry Bolhuis (iDevcloud) was kind enough to provide a reduced rate. I decided to use a PHP project–knowing it is a current and hot technology, the cost would be minimal and it’s a skill that I am comfortable with.

The plan was to use a LUG member organization project for the learning experience and to enlist local user group members as participants. Once the concept of having a project coded for free was understood it was not difficult to find organizations willing to provide a project for the activity. The only requirement for an organization or individual to participate was they had to be a current LUG member.

It was easy to round up a group of 20 participants with varying degrees of skills and exposure to Web development. We split into teams, not to compete but to allow all participants an opportunity to roll up their sleeves and actively work on the project. The chosen project was quite robust including add, change, delete, inquiry, internal user application, external user application, email notification with attachments, creation of PDF and excel documents, call to an RPG program, and security requirements. Detail specifications were provided for the project.

The first meeting kicked off with an overview of PHP and a review of the project plan. Participants were given homework to start the learning process. It was interesting to see how each team took a different approach to creating applications, how quickly teams were able to begin coding and also to see how the teams bonded during the learning process. Participants had varying skills and did a great job working with and helping each throughout the activity. The meetings/sessions were completed with participants joining in remotely using GoToMeeting. We had on-site interaction before and after regularly scheduled user group meetings. Most participants were from SEMIUG and a couple from WMSUG. The activity was completed over a three-month period. We used Zend studio for coding and everyone was set up with the capability to sign on to the box remotely. Part of the project requirement was to code and test the applications and also to create user documentation.

At the end of the set timeline we scheduled a big reveal. The activity was a fun gathering held as a regularly scheduled user group meeting. Zend's Mike Pavlak was onsite for the big reveal of the completed projects. Each team showed its completed applications followed by a panel critique of the finished projects. Zend provided support throughout the project and also furnished prizes for meeting attendees and project participants including t-shirts, pins and copies of Kevin Schroeder’s book “You Want to do What with PHP?” After the finished applications were reviewed closely, a project was chosen and feedback was provided. Based on the system users’ feedback, all participants pitched in and did a final round of enhancements on the chosen application.

The outcome of the activity was beyond what we set out to accomplish. Forming teams and completing a project from start to finish also included developing and using project management and team interaction skills. Participants walked away with new skills. Several participants have already put their new skills into action, a member organization has a PHP application running in production (a new technology for their environment), and user group attendance and enthusiasm took a boost.

It was exciting to see how much effort participants put into the activity encouraged by their desire to learn new skills. I would like to see the hands-on LUG activity grow to include other user groups and provide an opportunity for more LUG members to learn/expand skills. Discussion and plans are already in motion to expand the activity to include other user groups. We are hoping to have another activity later this year. The first round proved the idea works with participants joining in remotely. The long-term success of the activity is dependent upon resource and funding. By including other user groups it is more likely the hands-on LUG activity will continue and will reach more i colleagues. We likely will do more PHP activities, but it is also a great fit for the development of other skills, such as RPG Free, ILE, SQL, WebQuery, iSeries Access for Web, RDp, RPG Open Access, mobile applications, etc. What are your thoughts on hands-on LUG activity?

January 31, 2012

The following blog entry was written by Larry Nies, president of NSC, Inc. He has been working with PHP on the IBM i since 2005, when he installed his first open-source PHP stack. The following year, he switched to the Zend Technologies PHP application server for IBM i.

While working with a customer recently on a PHP application that we had developed to manage the customer’s server user IDs and passwords, it became apparent that the application was going to need stronger security and encryption to protect the stored data. The Password Vault application, as we call it, runs on the IBM i using the Zend Technologies Zend Server. It allows a user to collectively store user IDs and passwords for websites, PCs, servers, etc, and provides the ability to manage them individually or by vault category.

The original scope of the project dictated that we needed a method to document the access to various servers and websites, and to have that documented information located in a secured area for access by the IT staff. Like everything else in life, we all have a tendency to misplace or forget our passwords/user IDs especially on those servers or websites we don’t access often.

Writing the PHP application was the least of our issues as it involved some PHP, CSS, jQuery and AJAX. Then, voila, we were ready. As we wanted to assure that we had protected our precious data, some critical thinking to bring it all together was necessary. We discovered the Zend Server system includes built-in OpenSSL extension.

We began to look into using our PHP application with the Zend Server in conjunction with an IBM i Apache server instance to secure the data. From there we began adding to the Apache instance the ability to listen on Port 443 (the default port for SSL). When we made the changes to this HTTP instance, we also generated an application ID that we could use in the IBM Digital Certificate Manager. Now we could attach a local-generated certificate to that application ID. To verify our digital certificate credentials, we used the SSL Shopper website, which runs an SSL checker to determine if everything is lined up properly in your certificate. Once this was completed, we ran our PHP application using the HTTPS protocol, providing the protection we were looking for.

In the end, we used the Zend Server PHP application server, IBM’s Apache instance running the Zend Server and listening on Port 443 for our SSL, and last but not least IBM’s Digital Certificate Manager--all of this running on our IBM i. Just goes to show with a little bit of thought and planning you can get more out of your IBM i.

September 14, 2011

The following blog entry was written by Larry Nies, president of NSC, Inc. He has been working with PHP on the IBM i since 2005, when he installed his first open-source PHP stack. The following year, he switched to the Zend Technologies PHP application server for IBM i.

During the six years I have been working with PHP on IBM i, I have seen it evolve into a sophisticated Web-application language. In 2006 one of my customers began using Zend Core and Zend Platform (from Zend Technologies) and has since moved to Zend Server.

I wrote my first application with nothing to guide me except a couple of samples that someone else wrote to run on a non-IBM i platform. For example, I was looking for an application to allow a customer’s customers to download/upload files (due to the email file size limitations). I found a UNIX open-source PHP script for FTP that was written by Edwin van Wijk. I downloaded Edwin's open-source PHP version and then decided that if I was going to change this script to work on the IBM i, I might as well have it work for Linux, Mac and Windows as well, to cover the customer’s other FTP servers.

Initially, I had to change the program to also allow public access without a login, as that was the method that my customer wanted to use. I then went about parsing the data received back from the various platforms--IBM i, Linux, Mac and Windows--when FTPed so as to provide a Windows Explorer look, similar to that which was in the original PHP script. Once I got the data stream parsed, based on the server platform, I began the task of streamlining the selection of the “FTP Hosts” using an array and a config.ini file that included all of the information needed to make the various server connections. It looked something like this:

Now that I had my config.ini file with all of the server information, I could add as many FTP platforms that I wanted to various FTP servers. Not only does this open-source code work with IBM i but it is also cross-platform enabled.

Have any scripts you’d like to share? Please add them in the Comments section below.

August 18, 2011

This PowerUp blog post was written by Laura Ubelhor, who owns and operates Consultech Services, Inc., a Rochester, Mich.-based consulting company established in 1992. Laura has extensive hands-on experience specializing in IBM i application technologies and working with a long list of clients in a variety of businesses.

We have had great success using PHP for Web application solutions. Some of the applications we have implemented include vendor portals, inventory inquires (with product images), inquiry applications with options to create HTML, Excel and PDF format output, Web-based event registration, project/task and time tracking and one of my favorites--an AP Inquiry.

The AP solution is a great fit for the need. Because vendors receiving electronic payment no longer receive a check with a remittance advice, there was a need for providing payment details. A separate remittance advice could be printed and mailed but we decided to automate the process and make the option available to all vendors. The solution included using PHP to send e-mail notifications using the mail function. The e-mail lets vendors know a payment has been made and also directs them to a Web inquiry for payment details. The application provides payment details, payment history and open AP inquiry with payment due date. Implementing the solution has significantly reduced phone calls. Vendors are pleased because they can easily and quickly find payment information. Our customers are pleased because the application has freed up internal resources by reducing time spent on phone calls and follow up.

Using PHP allowed for providing a low cost, user friendly, robust solution. We are enthused about PHP development and look forward to many more PHP projects.

What application solutions have you completed or are considering using PHP on IBM i? Share your experience in the Comments section.

IBM Systems Magazine is a trademark of International Business Machines Corporation. The editorial content of IBM Systems Magazine is placed on this website by MSP TechMedia under license from International Business Machines Corporation.