Showing posts with label Zend. Show all posts
Showing posts with label Zend. Show all posts

Wednesday, September 15, 2010

Updating Zend Framework on IBM i

Several IBM i customers have asked me about Zend Framework. Everything from should we adopt to how do we do it? I will talk about updating ZF in this piece but for a lack of sounding impertinent I have to reply to their inquiries about adoption with “It depends…”

It is no secret that the brass ring of PHP coders is framework based development. It’s not so much that Zend purports this approach as it is the community. The Zend Framework team has done an admirable job responding to the community with an enterprise grade solution. If you look at what solutions were around before Zend Framework you can easily see the need for such a solution. In its early stages, Zend Framework was created to address the plethora of frameworks that were being developed concurrently and were grossly incompatible. In other words, applications built with Cake would have to be modified in order to seamless integrate with Smarty. What’s even more concerning is the number of PHP developers out there who insist on creating their own framework for each company they work for. Since each company is different, they should get their own framework is the rationale. The reality is, however, a generic Framework that has attributes like modular design principles and a use at will architecture may very well be the right approach. But at which time? Many i5 shops are still kicking the tires of PHP and that’s OK. When they hear about Zend Framework they want to know more. I do not try to discourage folks from looking at Zend Framework, but do try to enlighten them as to the realities. And the reality is that you can use Zend Framework with just a cursory knowledge of PHP. But to understand Zend Framework you need a little more background in PHP and OOP. This is where RPG programmers get into trouble. Believe me, after 15 years developing RPG programs I too struggle with ZF and OOP. But that is because I feel I have to understand all the code before I use it. If you wait until you understand all of ZF before you use it, you may never get the chance to start taking advantage of its principles. So, let’s start in the beginning, updating your ZF implementation.

ZF upgrade process for IBM i

Zend Framework, the fabulously useful framework for building applications with PHP comes with Zend Server. But, the current version of Zend Server that installs on IBM i may not be as current as the version you wish to install. Or, maybe you would prefer to back-level the current version of ZF to be compliant with an applications requirement. Most users of the Zend Framework are far more interested in a more contemporary version of ZF as the development team is running fast and furious on new features. So, as there may be various ways to perform the update, the method identified here strikes me as the most efficient. As I try to maintain my position as one of the laziest programmers in New Lenox, techniques like this help me maintain a significant distraction rate while the computer does all of the heavy lifting! If you would like to share your favorite approach, please feel free to comment! This article will discus, in detail, the steps you can use to update the ZF library on your IBM i. In case you were wondering, this short snippet of ZF code can show you what version of ZF you have installed:
Let’s get a little housekeeping squared away. First, you will need to download the most current "stable" distribution from the ZF home page (http://www.zendframework.com/download/latest). As of this writing, 1.10.8 is stable. I chose 1.10.8 because I like things that are stable. That's why I am on an IBM i! If you prefer an older release you can check those out at the Zend Framework Archive . I brought this file down using the tar.gz option and not the .zip. I’ll explain why in a bit. You will also need all of the prerequisite License Programs as indicated by the Zend Server for IBM i Installation Guide available as a no-charge download at Zend.com. Last but not least, BACKUP YOUR WORK! Anyone who assumes all will be well with the universe when treading new ground has never met Murphy. As a ¼ Irishman I must acknowledge that little bugger and pay him his due. So, even a measly save file in QGPL is better than nothing. It sure wouldn’t hurt to dust off those operations skills and see if you can run the tape drive or at least make sure operations has backed up the IFS in the last few days (weeks, months, years?). The directory we will be messing with is ‘/usr/local/zend’ I would heartily recommend using the SAV command and saving that entire directory to a save file and then copying the save file somewhere. Tape is preferable; a network file share is OK too, as long as it gets backed up!


OK, with the housekeeping done I can climb down from my operations soap box and we can get busy. First you need the download file. This file can be brought down in either the windows .zip format or the Linux/Unix tar.gz. Since I am going to leverage the PASE environment to do my dirty work I chose the tar.gz format. But let’s explore what the heck that really means. Tar is a Unix command that stands for, believe it or not, Tape Archive. This is a method supported by nearly all Unix based systems and since PASE is an AIX runtime, it is no exception. PASE appears to fully supports the tar command and most of its options. Ok, that explains the .tar extension, but what the heck is the .gz mean to me? Ah, this is a little more interesting. In windows land we typically use a utility like PKZip to archive and compress all at the same time. In Unix land, we have two steps. I indicated that the tar command archives the files into a single tape file. The .gz stand for GNU-Zip which then compresses the file. So, since the file was archived first and then compressed, you need to do the reverse when opening up the files for access. As I indicated I like PKZip for getting rid of the .gz extension. Oh, and do not trust Windows to tell you the extension. You may need a DOS prompt to show you the real file name is: ZendFramework-1.10.8PL1.tar.gz.


So, chose your favorite PC based compression utility, open the GNU-Zip and extract the tar to a local directory. With the file in a local directory it is possible to FTP the file to a temporary directory like, /usr/local/zendsvr/share/ZFtemp on the i. That should be all you need your PC for! You can use an FTP utility if you like but I am still pretty comfortable with the command line options. Here is my script for FTP from the DOS prompt on my PC and I typically put things I need to FTP in a directory off C: called temp:

cd /usr/local/zendsvr/share/ZFtemp
lcd c:\temp

put ZendFramework-1.10.8.tar


With the file on the IFS we can now take advantage of the IBM i and let it rock through the rest of the process. So let’s rename the current ZF directory. It should be located in /usr/local/zendsvr/share/ and is called, simply enough, Zend Framework. From the i5 command line issue the WRKLNK command for the /usr/local/zendsvr/share/* directory and page down till you see Zend Framework. Take option 7 to rename the directory to something useful like ZendFramworkOldVersion or something like that. This technique may come in VERY handy should you need to back out the upgrade for any particular reason. Now take that temp directory and rename it to the proper Zend directory, or something you prefer.
From here you may start a PASE Shell by using the CL command CALL QP2TERM. This will start a PASE shell interface and any Unix command line loving geek out there will start to feel right at home since you are now, essentially, at an AIX command line interface. Remember that PASE is an AIX runtime so while it supports MANY AIX commands it may not necessarily support all of them. Check out the PASE command reference on the IBM website. From here, navigate to the directory where you wish to install Zend Framework. I chose the same directory it was already in so I would not have to adjust any hardcoded scripts or includes in the PHP.ini. The command would look something like cd /usr/local/zendsvr/share/ZendFramework and then issue the command to unzip the ZF file system. There are MANY files that make up ZF and to use netserver to do the drag and drop might be cumbersome. Ultimately, it’s up to you.

To unzip the file, or actually untar, the command is: tar -xvf ZendFramework-1.10.8PL1. let’s look at this command as it is a little different than your typically CL command. The –xvf represents switches that control the behavior of the command. x means extract the contents, v means give detailed messages about the extraction and f means the next parameter in the command is the file name of the archive. More information about tar can be found on the GNU website and also the manual .
Now that the unzip is complete there is only one step left to update the php.ini file. If you plan to use Zend Server for IBM i to load the path to the Zend Framework library, then update the path directive via the Zend Server Admin Interface. Log in to Zend Server and Navigate to the Server Setup tab and then the directives sub-tab. Click the twistie for Paths and Directories to reveal the php.ini directive for “include_path”. There should already be an entry for Zend Server in there. There is no change necessary as long as the new ZF files in the same directory. If another directory is selected, simply edit the value in the box to the right of the directive, click save changes and restart Zend Server. You are off to the races!

Monday, January 19, 2009

A little light reading...

I have not been a very good reader. Seemed to struggle with it most of my life and to this day if I read anything longer than an error message I tend to lose interest. The most recent book I read, cover to cover, was Eric Clapton’s auto-biography. It is packed to the gills with action and adventure and I could not put it down! OK, so there was no James Bond type action. But there was a LOT of adventure and name dropping. I highly recommend if for anyone who considers themselves a fan of the British invasion and the influence of R&B on musicians of the 60’s and 70’s music scene. Clapton covers a lot of ground and I look forward to a movie sometime soon. I read the book while at my computer and when I came upon a name or song I did not recognize I used the web to research it. Amazing how the web continues to integrate into our lives!

But, that is not why I am writing this piece. I am writing today to extol the virtues of the PHP Architect magazine. I just got my January edition and in the spirit of the changing of the Presidential guard it too is choke full of change! If you are an experienced PHP’er or just kicking the tires you will no doubt gain benefit from the content in this publication. Not too much advertising and a delivery model that supports both paper and PDF makes it especially enjoyable to the folks on both sides of the environmental fence!

First, the proprietor of the magazine, Marco Tabini, has tapped some really strong folks to help him put the publication together. This is very representative of what I love most about PHP: the passion of the community! This sense of community is exhibited by the new Editor in Chief Elizabeth Tucker Long and her first Community Corner article about how it takes a village to make a programmer. She does a great job of describing her own growth from a development silo to her emergence as a pillar of the PHP community.

The January edition takes a strong focus on Zend Framework and how it can simplify the PHP environment. There is some very good content regarding components like Adobe Flex, Zend Search Lucene, and an Intro to Zend_Cache! I know there has been a ton of interest in the IBM i community about Zend Framework so this might be a great place to get some familiarity.

There is a nice piece that discusses the pro’s and con’s of the certification process. I for one have always been a big fan of the cert process as a means of education. I remember the first time I took the RPG certification test with IBM and how much I learned from that experience. It made me a better RPG programmer and that is what helped me sell myself as an independent consultant and RPG programmer. This comes in handy for me as I pursue my own Zend Certification.

There is plenty for Enterprise customers too with an article from Ivo Jansch about requirements analysis and another bit on security using CAPTCHA. I know that there are folks in the IBM i community discussing CAPTCHA as it was a major topic in the Midrange.com threads a few weeks back.

I do not get one thin dime from Marco for writing this. I am just a big believer in communication whether it is from SystemiNetwork, PHP architect or the PHP Community. Learning PHP is important and there are many out there ready willing and able to help. Now it’s your turn to go and get it!

Monday, January 5, 2009

Happy New Open Source!

It’s that time again to look into the crystal ball of the New Year and make some optimistic predictions about what we will get done. I, for one, am very excited as one of my New Year’s resolutions is to explore the other sides of the PHP house in more detail. Since joining Zend back in May I have spent a majority of my time focusing on the IBM i products and market position. Don’t worry, you will continue to see me pop up here and there to chat about IBM’s latest festivities and what Zend and PHP have to offer the ever challenging midrange space. There is a world beyond IBM i.

First I am exploring Zend Infrastructure on Windows. While Windows is hardly new to me, I am not nearly as well versed in XP, Vista or the various Server models as I am with IBM i. Going through the installation process was a pleasurable experience as there were very few bumps along the way. Got one of my favorite applications, Sugar CRM, up and running in no time. Next challenge to tackle is the LAMP stack.

As I have railed about in the past, you need to take control of your own career. Learning something outside your core competency will pay dividends right now as nearly EVERYONE is being asked to do more with less. Those who have focused beyond the four walls of their comfort zone will now be able to contribute and present more value to the organization. Thus, challenging management to look elsewhere when the old “RIF” devil comes haunting around.

Economic figures are all pointing downward for 2009 and Washington is about to do what it can, print more money. But we in the open source space are confident. One of our CTO’s, Andi Gutmans wrote a nice blog entry that summarizes Zend’s position for 2009. I couldn’t agree more with Andi. And I think this plays well in the IBM i space as well as the LAMP/WAMP stack. Companies need to continue to do more with less. Open Source makes that a REAL possibility.

A recent message on the midrange.com thread WEB400 discussed the merits of creating a CRM on demand application vs. acquiring an open source solution and “tweaking” it. It was a lively discussion, but one that tasks all of us. To do more with less, we must be willing to think outside the box. Open source is available to the IBM i. Consider taking a look, even if you don’t look at PHP. There are many solutions worth noting!