Want to get started with PHP on the i? Well, the first step is to download the products that are available on the i from Zend. And the first part of that is to download the Zend Server. But how? And why?
PHP on the i. Why am I bothering to write about this? Mostly because I think we have reached a point where every RPGer and every IBM i should have some capability to do web-oriented languages. You might use Ruby or CGIDEV or even Java, but I'm a PHP fan.
You might decide to learn PHP yourself and build your own scripts, or you might find real PHP programmers and have them do the work for you. What's important is that unlike a web PHP app, which can be done on your PC, PHP apps that run on the i and interface with the DB2 database on the i, are going to need a development and run environment that runs on the i itself. And the best option for that is Zend Server. But many people have an ancestral fear of words that begin with "Z," so a little encouragement may help.
Before I begin, I want to put in a plug for ZendCon, the annual Zend conference. It's coming up the last week in October, and there's a tremendous lineup of sessions. If you're getting into PHP and Zend, it's the perfect place to be to get some solid education on the tools. I also need to send a big shout out to Mike Pavlak from Zend, who was kind enough to read this article and point out all my mistakes to me. So great to know someone like that who isn't part of my family!
What Is the Zend Server?
The Zend Server is a piece of software that provides a complete PHP development and run time environment. It includes things like PHP (which does not come preloaded on the i), an instance of an HTML server powered by Apache (because PHP generally runs on the server side of things rather than the client side like HTML), database drivers (SQL, DB2, etc.), and over 70 other packages that fit together to provide what you need to support a language.
You can roll your own, of course, but that takes a lot of time and patience, and you really need to know what you're doing, along with having an AIX LPAR and C compiler on the i. With Zend Server, it's all there, packaged nicely in one of those NFL-themed gift bags. All you have to do is download and install it.
Yeah, But It Costs Money, Right?
It could. The Zend people are very accommodating, and if you want to pay them, they're more than happy to help you. But there's a version of the server that's completely free and it makes an excellent starting point for exploring PHP.
There are really four versions of the Zend Server available and, without trying to be crass, it's a case of "you get what you pay for." That's fair.
The last time I wrote an article about this, Zend was offering a free Community Edition (CE). The CE is no longer available; it's replaced by the Basic Edition (BE), so the names have changed but the deal is more or less the same.
The BE is free forever, but it's available only if your platform is the IBM i (it's part of a special deal between Zend and IBM). Everyone else has to pay to get one of the other versions of the server.
And with it you get one year of Silver Support. After the first year, you'll need to pay for that support to continue, but on the bright side you might get fired or have your job outsourced before that year is up, so you might not have to deal with it.
So, problem solved, eh, mate? Just get the free version, learn everything you need to know in one year, and you're good. But, as I said, while the BE is a great way to get your feet wet, it doesn't provide everything and is probably not suitable as a production server or even as a heavy-duty development environment. So if you get heavy into PHP, you're realistically going to want to upgrade at some point.
Professional Edition, Enterprise Edition, Developer Edition
To be honest, there's a lot of stuff that you don't get in the Basic Edition. Yes, you can create apps and test them and run them, but it's definitely not…how shall I say this?...feature-rich enough to be used as a big-time development or production machine.
The Professional Edition is the most popular, giving you everything you need for a normal-sized production environment, and the Enterprise Edition is positioned for the big dogs who are running enterprise-size networks. The primary difference between the Professional and Enterprise editions is the degree of SLA and LDAP integration.
You may wonder why there's a Developer Edition at all; wouldn't you just get Professional and call it good? But many companies will run several versions of the Zend Server, particularly one for development and one for production. And that's where the Developer Edition comes into play.
Z-Ray is not available on the Basic Edition (which is one reason why it's a good way to start but will not be the best route once you pick up speed).
Downloading the Zend Server
No matter what edition of the server you get, you need to download it. That's not a difficult task, but neither is it as simple as hitting a button in the iTunes App Store and downloading The Clover's Greatest Hits. There are a couple of steps, so let's talk about that.
Start by accessing the Zend website. By the way, at some point you're going to register your i, so be sure you have your serial number handy. Also, don't kick off the download until you've looked at the Installation Instructions (see below).
There are various ways you can do the download (because there are several ways to navigate to that page), but I recommend that you hover on the "Try and Buy" text on the home page and select either the "Try Now – Zend Server" (if you want the 30-day free trial) or the "Buy Now – Zend Server" if you just want to start paying and be done with it. The 30-day trial gives you access to the Enterprise Edition. When the 30 days are up, you can either sign up for that version or ask for a Basic Edition license, pay nothing, and have the functionality drop back to the basic level (but you will still get a free year of Silver Support). There's only one download; your license will determine what features you have so that upgrading to a higher-level product does not require an additional download, just a different license.
Anyway, you will be directed to another screen where you can kick off the download. By doing it this way, when you get to the download screen, it will ask you to select your platform (UNIX, Mac, etc.).
Figure 1: Select your platform.
By selecting IBM i, the link to the Installation Instructions text is changed to be appropriate for the platform involved. It's the same version of the Zend Server, but the instructions to install it change by platform. And it marks you as an i person so that you're eligible for the Basic Edition once the 30-day trial is over.
You will also perhaps see more than one version of the server that you can download. As of this writing, the version of Zend Server is 7.0.0, but you can get that with either fries or onion rings—that is with PHP 5.4 or PHP 5.5 which is the newest version. I would go with the latest version of PHP, but I'm a thrill seeker, and you may have real reasons why you want to go with an older version.
There's one thing I guess I should mention here. IBM has gone to great lengths to ensure that, as new versions of RPG come out, everything that was in the older versions still works. This is nice, but it does mean a lot of outdated techniques remain supported (and therefore in use). Most web languages, PHP included, are not like that. As new procedures, commands, and ways of doing things come in, some of the older stuff is cut loose. This means some people don't want to upgrade from an older version of PHP. In general, the differences between more recent releases of PHP (like 5.4 to 5.5) are not hugely significant. But you'll want to test your old apps against the new release before going to production with it.
Getting back to the download, it will be done to your PC and will arrive in a zip format. You can unzip that and then FTP it up to the i.
Before you hit the download button, however, I would click on the Installation Instructions verbiage for the one you are going to download.
Figure 2: Click on the Installation Instructions.
Then, click on the first link under Contents (Installing Zend Server for IBM i). You'll see the following screen.
Figure 3: Install Zend Server for IBM i.
Check out the prerequisites for your particular OS level, and also look at where the product should be installed on the IFS (that's where the Zend Server and all of your PHP documents will reside).
There are two ways in which you can carry out the install: Silent and Interactive. Silent just goes through the steps without an installation interface. Interactive uses the more typical installation window and steps you through it. Your choice. Click on whichever one you feel the most comfortable with (just below the big, blue "Installing Zend Server for IBM i" type) and step through the instructions. Just remember, you'll download the package to your PC, unzip it, and then FTP it to the IFS on the i. Plus do some other stuff as indicated in the Install Instructions.
What Are You Waiting For?
It's really a pretty simple procedure; only a couple of minutes and 300M of storage sets you up to start your PHP journey. The link here is for the installation instructions for the i.
Zend Server. If you have it, learn to use it. If you don't have it…well, need I say more? Next month, if the Piggly Wiggly man doesn't drop the eggs all over the front yard and end up making "grass custard," we'll talk about the things you can do to the Zend Server to customize it.