Informing the IBM Community

Running Open Source PHP Applications


Open source word cloud illustration

Way back in March last year, I wrote an article for that talked about how to get started with PHP on IBM i.

In that article I touched briefly on the fact that PHP on IBM i gives you the foundations you need to start using a wide range of open source software.

Since then I’ve run workshops about this very topic at COMMON events in the UK and Netherlands, and in this article I’m going to share some of the lessons I have learned with you.

Why Open Source PHP?

Open source software is increasingly gaining acceptance as a way to cheaply and easily provide solutions for common business needs.

Typically, source code is provided free of charge under license, with rights granted to use, study, change, and distribute the software.

Open source software, I’m often heard to say, is free, but free like a puppy. The initial price tag might be zero, but you still have to feed it and clear up after its little accidents.

So it goes with open source software – the code is free, but you still have to install and maintain it, perform backups etc. In some cases certain features don’t come with the free version and you’ll have to put your hand in your pocket if you want them.

And if you want professional support, expect to pay for this too.

Open source isn’t limited to PHP – it can be any language on any platform. So why did IBM choose to bring PHP to the i?

Depending on who you ask, anywhere between 50 and 80 percent of websites use PHP to some degree. The size of this figure is undoubtedly due in part to the popular open source software.

Magento – one of the most popular ecommerce platforms – is written in PHP.

So are the top three content management systems – WordPress, Joomla and Drupal.

MediaWiki – the software that runs Wikipedia? Yep, PHP.

The huge popularity of the language, along with the wide range of open source software available, made it an obvious choice.

The other common factor that the aforementioned software share is the database. All of them use MySQL. And MySQL is also available on IBM i. No, seriously, it is – you just might not recognise it, because it’s called Zend DBi.

Zend DBi is basically the open source MySQL binaries compiled to run on IBM i and Zend have made it incredibly easy to install.

What is needed?
Zend Server paired with Zend DBi are all you need to get going with some of the web’s most popular applications.

Thanks to the relationship between IBM and Zend, as the proud owner of a Power server running IBM i, you can use this software for free. If you’re installing it for the first time, you’ll even get a taste of Zend Server Enterprise version for 30-days.

I won’t bore you with the details of how to download and install these products – Zend are far better at that than I am.

Downloads can be found at and all the information you need to install the software is at

Just make sure that when you install Zend Server, you take the option to install Zend DBi too.

If you already have Zend Server but don’t think you have Zend DBi, all you have to do is take option 6 – MySQL Management menu – from the main Zend Server menu on a 5250 session.

If Zend DBi is already installed you’ll just see another boring menu, but if it’s not then taking this option will trigger the installation process.

A word of warning – by default, Zend DBi’s root user – the equivalent of QSECOFR – has no password. This is a bad thing. You can remedy this from the command line.

Go into QSH or QP2TERM and enter the following commands:samways jan 11 01
You’re now in the MySQL command line interface. Enter the following:
samways jan 11 02where <myPassword> is the new password.
The root user is now lovely and secure. The next time you want to get into the MySQL command line interface, you will need to enter:
samways jan 11 03
Packaged applications
Once Zend Server and Zend DBi are up and running, the quickest and easiest way to dip your toe into the world of open source is by installing one of the sample packaged applications available via the ‘Getting Started’ page of the Zend Server console.

Seasoned Zend Server users will already be familiar with the console and, if you’ve just installed the software, you will have been directed to it during the last step of the installation.

The URL to access it should be https://<yourServer>:10081/ZendServer/Login, where <yourServer> is the name or IP of your IBM i.

Log in and navigate to the ‘Getting Started’ page, and you will see something like this:
samways Jan 11 04
Now you don’t need to be a super sleuth to spot some of the names I mentioned before – Magento, Drupal, WordPress and Joomla.

What Zend have done is package up these popular applications so that they can be deployed painlessly within Zend Server.

Click on one of the icons – go on, don’t be shy – and a wizard is launched that takes you through the steps needed to deploy the selected application.

samways jan 11 05
Taking Drupal as an example: the software package will be downloaded; you will be shown a readme document, enter some application details and parameters, and accept the software license. Zend Server will then do the rest – deploying the software in the IFS, generating Apache directives and creating the required MySQL database.

Finally, you will be taken to the ‘Manage Applications’ page in the console, where you can find the URL to access the application. Simple!

Each application has its own unique set up steps, and rather than tediously go through each one I’ll simply direct you to the Proximity resource centre at where there is a ‘Quick Guide’ for each of them.

After deployment you can manage and monitor the applications through the Zend Server console. This allows you to set up alerts to keep track of application performance, caching rules, and so on.

Applications from source
Now it’s very kind of Zend to have gone to all the trouble to make these applications so easy to be deployed. However, we can’t expect them to do every PHP application under the sun.

Some notable names are missing from the list – what of the aforementioned MediaWiki, or the seriously popular CRM software that is SugarCRM?

Well, the truth of it is that if you know of a PHP and MySQL based open source software, you can probably deploy it on IBM i.

The first step is to load the source code into the IFS in a sub-folder within the /www/zendsvr6/htdocs folder.
First create the sub-folder. I use the mkdir command at a 5250 command line to create it. To avoid problems later, user QTMHHTTP should be given full authority.

Now upload the source. I use an FTP client to do this – my personal preference is FileZilla.

If the source download comes in a .zip archive, it can be downloaded as is then unzipped using the jar command in QSH or QP2TERM:
samways jan 11 06where <myFilePath> is the IFS path of the object.
Similarly, .tar archives can be untarred using the tar command:
samways jan 11 07
You can then point a browser at https://<yourServer>:10080/<subfolderName> where <subfolderName> is the subfolder within htdocs, and off you go.

OK, so there is sometimes a little more to it than that…
Often, an installation script will run to perform additional set up when you access the software for the first time.

Some software may even need you to perform minor PHP changes – I’m looking at you, MediaWiki.
But with a little time and patience, and – where necessary – reference to our old friend Google, you can usually get things running.

And once again, where I’ve been through the process myself, we have a Quick Guide available at

Guides are available, at the time of writing, for MediaWiki and SugarCRM, along with Mantis Bug Tracker and Adminer.

As a final step, it’s also worth creating a definition within Zend Server, as this allows you to manage the application in the same way as one deployed from a package.

Do this from the Manage Applications page in the console.

Click on the ‘Define Application’ button, enter the Base URL and Application Name, and your application can be monitored and managed just like a packaged one.
samways jan 11 08
As an IBM i user, the likelihood is that the core business software you use is legacy green-on-black.

It’s unlikely that you will find an open source solution that will replace this for you, but it can give you interesting options when it comes to filling other business needs.

Want a bug tracker to help you manage an internal development? Why not try MantisBT.

Need a way to collect information and make it easily accessible to your users? Maybe a wiki built with MediaWiki could do the job.

At Proximity, we now use Drupal to manage the content of our websites and SugarCRM to manage our customer relationships. All running on IBM i. The cost to the company? A little more than zero.

So why not give it a go.

If you’ve any questions about getting started with open source PHP applications on IBM i, or want to share your experiences, you can find me on Twitter: @pete_samways


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.