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.
Creating Zend Server 6.1 app
Using Zend Studio 10.5+ IDE
Notice that you can add MySQL database cartridge to your app right from the dialog window.
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
- Create standalone Zend Server 6.1 cartridge
Using OpenShift Web Console
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
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:
- Agree to Zend Technologies Ltd. End-User License
- 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
- Pick the User Passwords – Set passwords; Password for ‘admin’ user is required
- Deploy Library Packages – Deploy Zend Framework 1 & 2 and Zend Server Gateway libraries
- 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.
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')); // 127.0.250.1 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@127.0.250.1:3306/
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
Screenshot: Zend Statistics component – Zend Server Administration Console.
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.
Screenshot: Zend Framework 1 & 2 and Zend Server Gateway libraries deployed by default.
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.
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:
- Put your
zend-5.6app to maintenance mode
- Back up the
- Delete the
- Create new
zend-6.1app with the same name as the old app (you might wait for OpenShift DNS a few minutes)
- Copy over the backed up code+data to the new
- Put the new
zend-6.1app back online
Alternatively, you might want to follow the other migration steps when using custom URLs for your app:
1. Create new
2. Add alias to the new
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
5. Put the new
zend-6.1 app back online
6. Switch the CNAME to the new
7. Wait for DNS records to get propagated
8. Wait several days (due to possible DNS delay) and delete the old
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:
- OpenShift walkthrough
- Zend Server cartridge Getting Started Guide
- Manage your Zend Server apps using Zend Studio or OpenShift command line tools
- Zend Server User Guide