Differences Between Zend Core and Zend Server on IBM i

Zend Server for IBM i improves upon Zend Core’s older implementation of PHP in numerous ways. To make the migration easier, I’ve created a table that shows some of the settings and default file locations that have changed between Zend Core and Zend Server.

Zend Core
Zend Server
Installation folder
/usr/local/zend/core
/usr/local/zendsvr
PHP.INI
/usr/local/zend/core/etc
/usr/local/zendsvr/etc
Web server root(s)
/www/zendcore,
/usr/local/zend/apache2
/www/zendsvr
Document root
/www/zendcore/htdocs
/www/zendsvr/htdocs
Zend Framework
/usr/local/Zend/ZendFramework
/usr/local/zendsvr/share/ZendFramework
PHP binaries folder *
* where php and php-cli reside
/usr/local/zend/core/bin
/usr/local/zendsvr/bin
PHP Log files
/usr/local/zend/core/logs
/usr/local/zendsvr/
var/log
Web user profile (assign authority to it)
NOBODY
QTMHHTTP
Default HTTP Port
:89
:10088
Admin Interface URL
http://yourIBMi:89/ZendCore/
http://yourIBMi:10088/ZendServer/
Menu (5250)
GO ZENDCORE/ZCMENU
GO ZENDSVR/ZSMENU

If the new HTTP port of 10088 seems hard to remember, you can change it to something that’s easier to work with, such as the standard HTTP port of 80. To do that, edit /www/zendsvr/conf/httpd.conf and change Listen *:10088 to Listen *:80 or whatever you want. (Of course, first ensure that no other service is running on that IP/Port combination.)

Zend Server for IBM i Is Here

Zend and IBM have announced an updated, streamlined version of their PHP package for IBM i, called Zend Server. I’ve been using the beta for a while but last week read an announcement showing it’s ready for general use. It combines the best of Zend Core and Zend Platform in one package.

To get Zend Server, go to the Zend Server for IBM i page and click the green “Free Download” button. This will give you the “Community Edition (CE)” version, the free version that handles all the basics for running PHP on IBM i. It even comes with a year of free online support.

If you want to  upgrade to the non-CE version (it doesn’t have its own name), which gives you more debugging and tracing tools, as well as Job Queue functionality and more support, you can buy a license. Write to me if you need help or want to buy a license for the non-CE version.

Class ‘Zend_Db_Table’ not found

New developers sometimes struggle with putting all of Zend Framework’s pieces together. This week someone asked me how to resolve the error:

Fatal error: Class ‘Zend_Db_Table’ not found.

The answer: he needs to “require” the file containing the Zend_Db_Table class, like so:

require_once 'Zend/Db/Table.php';

or (my preference) use the autoloader:

// ZF 1.8 or later: add these lines to your bootstrap file:
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);

ZF isn’t complicated if you know the few things you MUST use. The autoloader is one of them.

If you need help getting started with Zend Framework, contact me about Zend Framework mentoring, training, or troubleshooting.

Our Zend Framework-based Site Honored by IBM/COMMON

We won! IBM has recognized my use of PHP and Zend Framework, and our entire team’s RPG/DB2 and design work, by naming our web solution the IBM i’s most innovative of 2009.

At IBM’s 2009 COMMON conference, IBM awarded the Power Systems Innovation Award for Best Web Solution for eBiz@ABG. The site, developed with my colleagues at  Strategic Business Systems, Inc., was created for New Jersey’s largest wine and spirits wholesaler, Allied Beverage Group.

The system offers product ordering, live inventory levels and pricing, and a full-text search of Allied’s large product catalog. The application was built with Zend Framework (the leading PHP framework) and runs entirely on Allied’s IBM i, leveraging Allied’s db2 database and time-tested RPG logic.

The site is password-protected, so unfortunately I can’t link to it here.

eBiz@ABG is one of the first sites to be built with Zend Framework on IBM i (System i, i5, iSeries, AS/400). It was a true collaboration with Allied, made easier because we all spoke the language of “i.” What’s more, by using large chunks of Allied’s existing RPG code that already handled the complex business logic, we saved time and avoided reinventing the wheel.

Zend Framework worked so well that I committed to mastering it and teaching the community about it. (ZF has a learning curve, but after that curve is mastered, ZF speeds development and offers easy maintenance and growth.) I earned my Zend Framework certification in August 2008, becoming one of the first 50 worldwide to do so and the first ZF-certified “i” professional. Since then, I’ve gone on to be a ZF/i mentor for other development teams, and have become a public speaker, sharing my PHP/ZF/i roadmap at conferences.

Thanks to Allied for the opportunity to collaborate on a great project; thanks to Strategic Business Systems for the support; and thanks to IBM for the award.

Why Use a PHP Framework?

At last night’s NY-PHP gathering, a fellow PHP’er and I discussed PHP frameworks. I told her I was developing an e-commerce site using Zend Framework. She replied that she’d been considering frameworks, especially Cake and Symfony, “but I’m not sure I need a framework at all. I write my own SQL; my apps work fine. What would a framework do for me?”

Setting aside the differences between PHP frameworks, I’m aware of at least 4 reasons to use them:

  1. Modular design: A home-grown application, with its ad hoc growth, can become a tangled mess that’s hard to change or enhance. Most mainstream frameworks provide a modular design that makes it easier to modify or add components.
  2. Flexible components: Sure, you can write your own authorization class in PHP, but why reinvent the wheel? The framework will provide an integrated component that handles not only your current needs, but requirements that you haven’t yet encountered (but that the framework’s community has). With a framework, chances are that you won’t have to redesign your authorization system when the users ask for something new.
  3. Best practices: As you use the framework, you’ll begin to absorb the practices and (we hope) good habits of the framework’s creators.
  4. New capabilities: Frameworks regularly add functionality to help developers implement new technology. These days, common enhancements involve AJAX and connections to the APIs of popular web service providers.

Developers may understandably wonder if mastering a framework is worth the learning curve. In my opinion, the effort to learn a framework will be repaid with applications that are well structured, flexible, and easily maintained.

Brand your site with a favicon

Favicons are those eye-catching little pictures that appear in your web browser’s address bar, favorites list (hence the name favicon, short for “favorites icon”), and, with modern tabbed browsers, on tabs.

Instantly recognizable when designed well, favicons represent the brand identity of sites that use them.


Examples

Wikipedia uses the “W” from its logo:
Wikipedia’s favicon

Digg’s favicon represents a person holding a shovel, an image that seems to have been created especially for the favicon:
Digg’s favicon


Usability in a tabbed, multitasking world

Tabbed browsers, such as Firefox and Internet Explorer 7, can show many page-tabs at once, squishing a site’s descriptive text.
Below are examples of tabs without favicons. What sites are they? I don’t know.
FireFox tabs without favicons

These have favicons. At a glance I see a seated robed figure (meditation site), a stylized “Ti” that I recognize as my private TikiWiki site, and a picture of me, which (if I can stop admiring its beauty for a moment), I know represents my blog.
FireFox tabs with favicons


Create your own mini work of art

Favicons are ordinary graphics, generally 16×16 pixels in size, named favicon.ico. How to make them? I found an easy method that even non-artists can use.

The free site FavIcon from Pics allows anyone to convert a normal-sized graphic into a favicon. Instructions:

  1. Go to FavIcon from Pics.
  2. Click the “Browse…” button to select an image from your computer’s hard drive.
  3. Click “Generate FavIcon.ico.”
  4. After a few seconds, the site will show a preview image and a download link.
  5. If you are pleased with your creation, download favicon.ico to your computer. Then transfer that file, via FTP or your preferred method, to your website’s root folder (often /public_html or /www).
  6. View your website with its new addition! (You might have to press the refresh button to make the favicon appear.)


Show your art

If this article inspired you to create a favicon, please add a comment here with the link to your newly enhanced site.

PHP mail() on IBM System i

My new article about mail() is available at MC Press Online. The article covers:

  • Zend Core’s implementation of mail() for IBM System i
  • How mail() compares to packages such as PHPMailer
  • Function definition and example
  • How to configure SMTP in Zend Core
  • Overriding defaults with ini_set
  • Troubleshooting

Read it here.

Javascript Debugger for FireFox: FireBug

Powerful yet unobtrusive, FireBug, a FireFox Extension by Joe Hewitt, runs in a frame that pops up only when requested or when an error occurs. It helped me solve two javascript problems today.

Thanks to Dell Sala, who told me about FireBug at Tuesday’s New York PHP meeting.