Optimize Your IBM i Web Application Using FastCGI

(Co-written with Alan Seiden)

FastCGIFastCGI speeds up web applications by pre-starting and managing jobs for popular languages such as PHP. FastCGI can be configured to handle any language that supports the FastCGI interface, as shown in this FastCGI configuration for node.js. When it comes to PHP, you can trust tools such as our CommunityPlus+ PHP siteadd to set good FastCGI defaults. You can also customize fastcgi.conf to accommodate higher traffic, multiple environments, and to solve problems. Read on as we explain how FastCGI works and how to configure it.

Read more

Detecting Memory Leaks in PHP Extensions During Development

memory leakWhen a PHP extension has a memory leak, mysterious crashes can result, forcing users to restart the web server for relief.

As official maintainers of the ibm_db2 and PDO_IBM extensions, we’ve been on a quest to find and eliminate any memory leaks from these popular PHP modules.

With such a comprehensive goal, we needed a strategy. For extensions that have comprehensive test suites we decided that, in addition to reviewing the usual regression tests, why not also use the tests to detect leaks?

What follows is a technical look at how we do it.

Read more

Update on Free, Open PHP for IBM i

php ibm i trainingSince last month’s post about free and open PHP on IBM i, we have been helping companies to get started with it.

We’ve seen excellent results with the open PHP package, known as an RPM. Starting with the PHP repository provided by IBM and Zend (Perforce) as a base, we are able to optimize PHP for the needs of each IBM i shop.

Especially appealing to us and our clients: this PHP is 64-bit and leans toward open standards, including ODBC. In exchange for a bit of setup time, you’ll have a system that’s lightweight, flexible, and license-free.

Read more

Free and Open PHP on IBM i

open php ibm iA new flavor of PHP has arrived in IBM i-land. Some call it “free.” Some call it “community.” As described in a recent IT Jungle article, PHP is now available on IBM i as a lean RPM download that does not require Zend Server.

Our friends at IBM and Zend (now Perforce) have packaged a bare-bones PHP edition for customers who want PHP but don’t feel they need to purchase the extra tools of Zend Server.

I’ll share what our open source experts at Seiden Group have learned as we’ve installed and optimized both traditional Zend Server and “open” PHP for our customers.

Read more

ZendCon 2015 starts October 19

This year’s ZendCon has a new location—Las Vegas—and more IBM i speakers than ever, including:

  • Tony Cairns (IBM)
  • Massimiliano Cavicchioli (Zend)
  • Jim Oberholtzer (Agile Technology Architects)
  • Mike Pavlak (Zend)
  • Stephanie Rabbani (BCD)
  • Chuk Shirley (Sabel Steel)
  • Shlomo Vanunu (Zend)
  • and myself, Alan Seiden (Alan Seiden Consulting)

Tutorial day, Oct. 19, is recommended at this premier PHP conference. I’ll present “Db2 and PHP in Depth,” a three-hour tutorial of techniques for using IBM i’s native database, which can help make PHP applications more secure, easier to write, and faster. I’ll also present new features of Db2 and PHP’s Db2 interface that were inspired largely by comments and requests of past ZendCon attendees. Special guest Tony Cairns from IBM is expected, too, for a lively discussion about practical PHP development on IBM i. Bring your questions.

Later in the week I’ll present “Create a welcoming development environment on IBM i,” based on my experience leading PHP projects for IBM i, and “Strategic Modernization with PHP,” which shows the possibilities on the IBM i platform and the strengths of various approaches. Expect to hear valuable advice from your colleagues, too.

I’m looking forward to attending talks, talking to sponsors, chatting with many of my blog and newsletter readers, meeting clients, and getting to know Rogue Wave, the company that recently acquired Zend.

Information about ZendCon: http://zendcon.com

iTalk with Tuohy interview

I recently joined speaker and consultant Paul Touhy for a spontaneous, personal ‘iTalk with Tuohy’ recorded chat, described thus: “Paul Tuohy talks to development guru Alan Seiden about developing in PHP, the PHP for IBM i Toolkit, performance for developers and getting your work-work balance right.”

The free recording is available here: http://www.ibmsystemsmag.com/ibmi/trends/iTALK-WITH-TUOHY/seiden-development-balance

Zendcon 2014 promo video for IBM i users

About Zendcon:

ZendCon+Tutorial discount expires Aug. 31

ZendCon, the premier PHP conference, October 27-30, 2014, in Santa Clara, California, has a discount expiring August 15 31 (extended!). When you register, be sure to include the tutorial day (Oct. 27). If you already registered but forgot to add the tutorial day, you can contact the organizers via a link at the bottom of the registration page. Among other half-day tutorials, I’ll be presenting two focused on IBM i:

  • PHP Performance on IBM i
    • If you’re interested in performance of PHP, or IBM i generally, in order to scale your application up to meet increased user demand, or if you have specific performance needs right now, you’ll want to attend.
    • Additional insight to be provided by IBM’er Tony Cairns (see below)
    • Testimonial from last year: “Our process now runs 30-50% faster, thanks to one tip from Alan’s presentation.”
      —Mike Meszaros, Software Developer, Specialty Pipe & Tube
  • DB2 with PHP in Depth
    • DB2 on IBM i has received major enhancements over the past year, including a dozen new settings in the PHP ibm_db2 middleware. Hear  how they can help improve security, performance, and stability. Other topics will include, but not be limited to:
      • Basic topics (with added commentary to make it interesting for everyone) such as library lists, prepared queries for security, persistent connections
      • DB2 in frameworks
        • Zend Framework 2
          • Including pagination (page-at-a-time logic)
        • Status of PDO and how it can be used in Laravel and other frameworks
      • The real scoop about modernization and the DDS vs. DDL (SQL) debate
      • Connecting to IBM i’s DB2 from Windows and Linux and other IBM i partitions
      • How to link MySQL-based applications (WordPress, etc.) to DB2 with the DB2 Storage Engine, with special tips
      • Using DB2’s HTTP features to make PHP-based web services even more accessible, including to allow RPG to call PHP and get results back
      • How to optimize queries
      • Strategies to safely open your application to the public
      • Topics and questions that YOU request (contact me in advance if you wish)

My co-presenter for tutorials will be IBM’s Tony Cairns, who helped bring PHP to the IBM i in the first place. He also created XMLSERVICE (toolkit back-end) and is a maintainer of ibm_db2 on the IBM i. One reason Tony comes to ZendCon is to hear from attendees such as yourselves. Normally he stays locked up in his lab. Take advantage of this opportunity to meet him. Watch Tony and me argue and debate in front of the class!

I’m also presenting a session during the regular conference about the PHP Toolkit for IBM i. I’ve updated my presentation with new features of the toolkit and best practices for calling RPG and COBOL.

ZendCon‘s topics are generally advanced ones to enable professional, enterprise-ready development practices. There’s also an IBM i track and plenty of networking time so that IBM i users of PHP can learn from speakers and each other, making the conference appropriate for intermediate users of PHP on IBM i as well.

Hope to see you there, October 27-30, 2014! Remember to register for tutorial day when you register for the conference. Get in touch with questions you’d like answered during my presentations.

Which version of Zend Server for IBM i do I have?

Here is the easiest way to learn the version of Zend Server installed on an IBM i system.
[Updated December 20, 2017]

From a 5250 command line, follow these four steps:

1. GO LICPGM
2. Take option 10 (Display installed licensed programs)
3. Scroll down to the licensed program 2ZSVRPI, 6ZSVRPI, or 7PHPZND 
     (on my system, it's the last entry)
4. Read the product description,
     containing version numbers for Zend Server and PHP,
     in the form "Zend Server for IBM i [version] ( PHP [version])"

On my IBM i, I see:
7PHPZND   *INSTALLED   Zend Server for IBM i 9.1.2 ( PHP 7.1 )
so Zend Server is at 9.1.2 and PHP is 7.1.

Thanks to Zend’s Sam Pinkhasov for this tip.

SSH on IBM i

Secure Shell (SSH), a network protocol used every day by software developers, provides a fast, secure means to transfer files and submit commands to remote servers.

Zend Studio 8.0‘s SSH support allows users to save their PHP scripts onto remote servers such as IBM i.

How to set up SSH on IBM i

SSH runs as a server program, the SSH daemon (sshd). Before sshd can run, it requires a set of public/private key pairs.

Instructions for creating the key pairs and starting the server are given below.  There are two versions of instructions, depending on the version of OS.

IBM i v6.1 and higher: one step creates public/private keys (if needed) and starts server

STRTCPSVR *SSHD

V5R3 and V5R4: two steps are required

1. First, create the public/private key pairs (only needs to be done once):

CALL QP2TERM
ssh-keygen -t rsa1 -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_key -N ""
ssh-keygen -t dsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_rsa_key -N ""

2. Then start sshd (“&” means to run in background):

/usr/sbin/sshd &
Either way, the daemon should now be running. To check, type NETSTAT *CNN on an ordinary 5250 command line. Look for a local port called “ssh” or 22.
For more information about setting up SSH, including prerequisites, see this “Young i Professionals” SSH wiki article and this old but still useful SSH article from Zend’s Knowledge Base.