A figure sits at a laptop, working on migrating Zend Server to ZendPHP
August 8, 2024

How to Migrate Zend Server to ZendPHP

Zend Server
Migration

Completing a Zend Server migration to ZendPHP is a daunting task for DevOps teams. However, with Zend Server 2019 having reached end of manufacturing and support on July 31, 2024, many are looking for a streamlined way to migrate and deploy at scale while keeping existing processes in place. To address this issue, I am excited to announce the new ZendPHP Ansible Playbook, an automation utility built to simplify migration from Zend Server to ZendPHP.

In this blog, I discuss how migrating from Zend Server to ZendPHP can benefit your team, the challenges present in migration, and ways that provisioning automation tools can help. I then walk through how to install, execute, and deploy the Zend Server to ZendPHP Ansible Playbook.

For more information about how to deploy the Zend Server to ZendPHP Ansible Playbook on IBM i systems, please visit this blog.

Back to top

Migrating Zend Server to ZendPHP

Zend Server is an application server, and as such is an all-in-one stack: it contains each of the web server, PHP, and all the various tools and services it ships with, which include monitoring, a deployment service, JobQueue, configuration management, and more. While this gives a great deal of power, it also contradicts one of PHP’s core strengths, which is the shared nothing architecture that allows spinning up more servers in order to scale. While you can purchase Zend Server editions that provide clustering abilities, it’s far more difficult to administrate when used in that fashion.

ZendPHP itself is just the PHP runtime, and as such, you deploy it as you would any other PHP runtime. If you want the features that you’ve come to appreciate from Zend Server, we offer ZendHQ. ZendHQ runs as a separate service, generally on a separate machine entirely, and any ZendPHP servers you spin up must be configured to communicate with it. This gives you the flexibility to scale PHP the way it is meant to be scaled, while giving you many of the same capabilities and features Zend Server provides, including monitoring, Z-Ray, code tracing, and JobQueue.

While many of the services provide equivalent (or, in many cases, expanded) functionality, because they have a different internal architecture, you will need to do some work in order to migrate to ZendPHP and ZendHQ.

Back to top

Common Challenges in Migrating Zend Server to ZendPHP

Despite the many benefits of migrating from Zend Server to ZendPHP, the migration process is not without challenges. However, with some planning and having the right tooling at hand, you can easily avoid or manage these difficulties as they appear.

Challenge 1: Provisioning ZendPHP

Probably the biggest immediate challenge for users will be provisioning ZendPHP and your web server of choice. Unlike Zend Server where you download the installer and run it, ZendPHP and ZendHQ use your operating system’s package management tools. Fortunately, we have tools such as zendphpctl which can be used to help automate this.

Challenge 2: Deploying PHP Applications

Once you have provisioned ZendPHP, you will still need to deploy your PHP application to it. With Zend Server, you could create Zend Server deployment packages (ZPKs), and use either its administrative GUI or the Zend Server client SDK to deploy them. Since ZendPHP more closely aligns with traditional PHP deployment, you have more options, but that could mean a change in your existing processes.

Challenge 3: Configuring PHP and Extensions

How do you configure PHP and enable and configure extensions? In Zend Server, these could be done using either the administrative GUI or the SDK, but how do you do these tasks in ZendPHP?

Back to top

Provisioning Automation Tools and How They Can Help

While these are all definitely new challenges, they also provide you with new opportunities. Zend Server’s all-in-one application server approach meant that you had to understand how Zend Server enabled these tasks — which meant if you went searching for how to configure PHP or enable extensions for PHP, you might not understand how to do those things in Zend Server. 

Because ZendPHP is distributed in a way that better follows traditional PHP installations and configuration, it also means that you now have a larger number of automation tools at your disposal to help you. This will allow you to provision your own servers, servers on cloud hosting platforms, or even using containers. Such tools are generally termed orchestration tools.

One such tool is Ansible.

About Ansible

Ansible is an open source IT automation software written in Python. Built to configure systems, deploy software, and orchestrate advanced workflows, Ansible supports application deployment, system updates, and much more. It is a straightforward and easy-to-use software with a strong focus on security, reliability, and simplicity.

Learn More About Installing Ansible to Deploy PHP Applications >>

Back to top

Introducing the New Zend Server to ZendPHP Ansible Playbook

As Zend works to meet the needs of modern DevOps teams, we have shifted our long-term product focus from Zend Server to ZendPHP. The Zend Server to ZendPHP Ansible Playbook, or zpk2ansible, makes migration to ZendPHP as painless as possible. It provisions ZendPHP and consistently deploys applications using existing ZPKs at scale.

How It Works

zpk2ansible is a Python tool that does the following:

  • It scans your ZPK to determine the application name, version, required PHP version, required extensions, and required PHP configuration.
  • It accepts command line arguments detailing which web server to provision (nginx, Apache HTTPD, or just PHP-FPM), and the name of a virtual host to answer to.
  • It generates an Ansible Playbook using this information, as well as one or more configuration templates for things like the PHP-FPM pool, general web server configuration, and virtual host configuration.

The playbook it generates holds a number of variables, which it then uses either in its various tasks, or as values to insert into the templates during provisioning. As such, you can then create an inventory file of servers you want to provision and deploy the application to, and then execute the playbook to do so.

Please note that you will need Ansible and Python installed on the machine from which you will deploy the application. These are NOT required on the target production servers, however.

Back to top

Zend Server to ZendPHP Ansible Playbook Walkthrough

In order to make your migration from Zend Server to ZendPHP as smooth as possible, I will now walk you through how to install, deploy, and execute the ZendPHP Ansible playbook. A video tutorial is also available below.


Step 1

First, generate your ZPK. This can be done using any tooling or processes you used previously. The only thing to note here is that the following features are NOT supported currently:

  • Hook scripts
  • Monitoring rules

Step 2

Create a Python virtual environment:

python -m venv .venv

 

Why create a virtual environment? It allows you to have different versions of the tooling for different applications, and does not require you to run the tooling as a privileged user.

Step 3

Next, install zpk2ansible. You will use PIP to do this:

.venv/bin/pip install https://repos.zend.com/zpk2ansible/zpk2ansible-latest.tar.gz

 

You can also indicate a specific version to use instead of “latest”.

Step 4

With zpk2ansible installed, you can now generate your Ansible Playbook from the ZPK. In the following example, we willl build one that uses the nginx web server, and answers to the domain name “test.example.org”:

./venv/bin/zpk2ansible build --nginx my-application.zpk test.example.org


This command will generate the Ansible Playbook, and provide a little information about what it did, as well as how to execute the playbook.

Step 5

Now it’s time to create an inventory file; for purposes of the example, call the file “inventory.yml”. Inventory files detail what hosts to deploy to, and how to connect to each in order to do so. The example below configures two hosts to connect to via SSH, zendphp-node1 and zendphp-node2, detailing the user to use when connecting and how to validate the security keys when doing so.

virtualmachines:
 hosts:
    zendphp-node1:
      ansible_host: zendphp-node1
      ansible_user: vagrant
      UserKnownHostsFile: /dev/null
      StrictHostKeyChecking: no
    zendphp-node2:
      ansible_host: zendphp-node2
      ansible_user: vagrant
      UserKnownHostsFile: /dev/null
      StrictHostKeyChecking: no


For more information on inventory files, read the Ansible inventory file documentation.

Step 6

With all of the above complete, you’re now ready to provision your servers and deploy your application! You can do this using ansible-playbook:

ansible-playbook –i inventory.yml playbook.yml


This will provision ZendPHP on your servers using the PHP version, configuration, and extensions that your ZPK requires via its own configuration. From there, it will install the web server (nginx, if you followed this example), and then deploy your application to it!

Back to top

Final Thoughts

As of July 31, 2024, Zend Server 2019 reached end of manufacturing and support. Teams currently using Zend Server 2019 are strongly recommended to migrate to either Zend Server 2021 or ZendPHP, as continuing to use this version can leave your system vulnerable to security risks, compatibility issues, and more. It is important to note, however, that ZendPHP migrations from Zend Server 2019 will need to be completed in stages and may include a temporary upgrade to Zend Server 2021.

Painless Migration With Support from Zend

No matter your plan, the Zend experts are here to simplify your migration through ongoing support and tools such as the ZendPHP Ansible Playbook. Reach out today to get started!

Talk to an Expert   Playbook Documentation

Additional Resources

Back to top