Zend Server 6.1 and PHP 5.4 Cloud Hosting - Archived

Good news for PHP developers, OpenShift Online introduces PHP 5.4 with Zend Server 6.1 and Zend Framework 1 & 2, the new product version of Zend’s Enterprise-Class PHP in the Cloud.

Zend Server on OpenShift logo pictures Zend Framework logo picture

Getting started with Zend Server 6.1 on OpenShift

There are multiple ways of how you can interact with your app on OpenShift. The recommended scenario is to use Zend Studio IDE to create and manage your applications. Another option is to use OpenShift Web Console or OpenShift command line tools. Read this blog post or Getting Started Guide for more details.

Are you new to OpenShift? See this nice walkthrough of how does it work and what’s the developer workflow.

Creating Zend Server 6.1 app

  1. Using Zend Studio 10.5+ IDE

    Creating Zend Server 6.1 cartridge from Zend Studio 10.5 picture

    Notice that you can add MySQL database cartridge to your app right from the dialog window.

  2. Using OpenShift command line tools

    • Create standalone Zend Server 6.1 cartridge

      rhc create-app MyApp zend-6.1

    • Create Zend Server 6.1 cartridge with MySQL 5.1 and PHPMyAdmin plugin cartridges; Do not clone git repository automatically

      rhc create-app MyApp zend-6.1 mysql-5.1 phpmyadmin --no-git

  3. Using OpenShift Web Console

    Creating Zend Server 6.1 cartridge from OpenShift Web Console picture

    Note: You can add a database cartridge of your choice (eg. MySQL 5.1) right after launching the Zend Server 6.1 cartridge.

Accessing Zend Server Administration Console

Once your zend-6.1 app is created, the Zend Server is already serving your PHP code. However, you’re kindly advised to access the http://MyApp-MyDomain.rhcloud.com/ZendServer URL to proceed several steps to finish the full launch of the Zend Server product:

  1. Agree to Zend Technologies Ltd. End-User License
  2. Choose the Zend Server Launch Type
    • Development – Launch Zend Server with server and PHP settings optimized for a development environment
    • Production (Single Server) – Launch Zend Server with server and PHP settings optimized for a production environment
  3. Pick the User Passwords – Set passwords; Password for ‘admin’ user is required
  4. Deploy Library Packages – Deploy Zend Framework 1 & 2 and Zend Server Gateway libraries
  5. View Summary

You only have to proceed the above steps once. From now on, you can leverage the power of Zend Server Administration Console and play with Zend components, PHP settings and extensions, libraries etc.

Zend Server Administration Console picture

Screenshot: Managing Zend components from Zend Server Administration Console.

Connecting to a database

Assuming you already added a database cartridge (eg. MySQL 5.1) to your app, as described in the previous paragraphs, you can now use the following environment variables to connect your PHP app to the database:

/* Environment variables exposed by MySQL database cartridge */
define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST')); //
define('DB_PORT', getenv('OPENSHIFT_MYSQL_DB_PORT')); // 3306
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME')); // admin
define('DB_PASS', getenv('OPENSHIFT_MYSQL_DB_PASSWORD')); // 8ddTnst22X3Y
define('DB_NAME', getenv('OPENSHIFT_APP_NAME')); // MyApp
define('DB_SOCKET', getenv('OPENSHIFT_MYSQL_DB_SOCKET')); // $OPENSHIFT_MYSQL_DIR/socket/mysql.sock
define('DB_STRING', getenv('OPENSHIFT_MYSQL_DB_URL')); // mysql://admin:8ddTnst22X3Y@

Read more about Managing your databases or see the full list of Environment variables exposed by OpenShift platform.

Features coming with Zend Server 6.1 cartridge

  • Support & Security Fixes by Zend Technologies Ltd.
  • Performance & Scalability (* At the time of this writing, Zend Server 6.1 cartridge does not scale on OpenShift yet. This may change in the upcoming releases.)
  • Configuration & Deployment
  • Monitoring, Statistics & Root-Cause Analysis
  • Mobile and Web User Intelligence
  • Enterprise Integration
  • Development Tools & Runtime, Debugging
  • Zend Framework Management
  • Zend Server Gateway

Read Full list of Zend Server features, What’s new in Zend Server 6.0 and What’s new in Zend Server 6.1 for more details.

Zend Statistics component picture

Screenshot: Zend Statistics component – Zend Server Administration Console.

PHP 5.4

Zend Server 6.1 cartridge comes with PHP 5.4 as default PHP version, as opposed to PHP 5.3 shipped with Zend Server 5.6 cartridge.

What has changed in PHP 5.4.x – quote from php.net:

Most improvements in PHP 5.4.x have no impact on existing code working on PHP 5.3.x. There are a few incompatibilities and new features that should be considered, and code should be tested before switching PHP versions in production environments.

Native support for Zend Framework 1 & 2

Zend Server 6.1 cartridge comes with a built-in management tool for libraries. During the launch steps, it deploys Zend Framework 1, Zend Framework 2 and Zend Server Gateway libraries by default. Read Deploying a library and Using libraries for more details.

Zend Server 6.1 with Zend Framework 2 deployed on OpenShift picture

Screenshot: Zend Framework 1 & 2 and Zend Server Gateway libraries deployed by default.

License Edition

  1. Enterprise Edition license

    Zend Server 6.1 cartridge comes with 7-days free Enterprise Trial license when instantiated. Users can extend the Enterprise Trial license for another 21 days by registering the Zend Server instance or switch to their already purchased license.

  2. Free Edition license

    Once the Enterprise Trial license expires and Zend Server process gets restarted, the application code continues to run with Zend Server now running in Free Edition. This edition is still perfectly suited for development environments but lacks features designed for production environments, such as extended data retention, Page Caching, Job Queue, and auto-generated root cause analysis.

    See this comparison of Zend Server Editions for more details.

Migrating zend-5.6 app to zend-6.1

Zend Server 6.1 cartridge is not backward-compatible with Zend Server 5.6 cartridge and thus it’s not possible to upgrade zend-5.6 apps to zend-6.1 automatically. However, you can migrate your app manually following these steps:

  1. Put your zend-5.6 app to maintenance mode
  2. Back up the zend-5.6 code+data
  3. Delete the zend-5.6 app
  4. Create new zend-6.1 app with the same name as the old app (you might wait for OpenShift DNS a few minutes)
  5. Copy over the backed up code+data to the new zend-6.1 app
  6. Put the new zend-6.1 app back online

Alternatively, you might want to follow the other migration steps when using custom URLs for your app:
1. Create new zend-6.1 app
2. Add alias to the new zend-6.1 app
3. Put the zend-5.6 app to maintenance mode (with message to users)
4. Copy over the backed up code+data to the new zend-6.1 app
5. Put the new zend-6.1 app back online
6. Switch the CNAME to the new zend-6.1 app
7. Wait for DNS records to get propagated
8. Wait several days (due to possible DNS delay) and delete the old zend-5.6 app


In this blog post we introduced PHP 5.4 with Zend Server 6.1 running on OpenShift PaaS, listed some of the new features coming with this version, and explained some differences to the old Zend Server 5.6 cartridge. See these resources for more information:

Get help on StackOverflow or talk to us directly at #openshift IRC channel on freenode.

News, OpenShift Online, PHP, Zend Server
Comments are closed.