PHPCloud — A New Easy Way to Run ZF2 Web Applications

In this post, I will tell about the PHPCloud, which is a new “platform as a service” which makes it possible to run your Zend Framework 2 based application in the cloud. The PHPCloud is currently in beta testing stage and available for free test usage. I think it is the best time to try it and become familiar with the capabilities provided by the service.

Why to Use PHPCloud?

Today, there are several options available of where you can install and run your Zend Framework 2 based web application:

  1. If your company manages its own server infrastructure and can afford upgrading PHP version to the latest one, you can install ZF2 on your private server.

  2. You can install a ZF2-based web application to a cloud-based hosting service, like Amazon Web Services. Amazon provides Linux server instances as a part of EC2 service. EC2 is rather cheap, and it provides a free usage tier letting you try it for free for one year.

  3. And the third alternative is installing a ZF2-based application is PHP Cloud. This “platform as a service” solution was introduced by Zend Technologies recently. PHP Cloud allows you to develop and install one or several of your web sites in a cloud container.

In this post, I will tell about the third way, which is the easiest one (in my opinion). This way is analogous to Amazon EC2 hosting service, but it automatically provides you with the hardware, operating system, web server and MySQL database, so you can just create a container and start working in a minute. By working, I mean creating an empty ZF2 application, opening it in your web browser and updating the code from your machine.

The difference of the PHPCloud service from Amazon EC2 is that you do not have direct access to the server through SSH terminal. Instead, you will update your code repository throug Git version control system’s client.

Creating a Container

In PHPCloud, web applications are installed to a container. You can imagine the container like a virtual machine with PHP engine installed. One user may have one or more containers. Next I will show how you create a container.

First, you have to log into your Zend account at the page. This is a page which provides access to BETA version of the PHPCloud and is free for test usage.

To log into your account, you need to enter your E-mail and password and click the Log in button (see the figure below for example). If you do not have an account, you will have to register and enter your E-mail address and password.


Once you have logged in, you will see the Welcome page (shown in figure below).


The Welcome page introduces you to the PHPCloud and lists its advantages: you can start coding in a minute and upload your ZF2 application via Git version control system.

Press the Start Now button at the right part of the Welcome page to open the “Create Container” page (shown in figure below):


On the “Create Container” page that appears, you will have to enter the container name (it must be unique among all other container names). Also, you will be asked to enter the container password (you will later use this password for accessing your container with Git client. You can choose a PHP version (5.3 or 5.4) and configure an SMTP server if you want to send E-mails from your web application.

Once you are ready, click the “Create Container” button to trigger the container creation process.

The next page is the “My Containers” page that lists the containers you have already created:

On the “My Containers” page, you can see the container you’ve just created. You can also request to create the second test container, if you wish. In this post, I will use the single container.

The “My Containers” page has the Snapshot, Revert and Delete buttons. The Snapshot button allows you to make a backup copy of the container if you need that. The Revert button is designed to roll back the container to one of its previous states (like you do in a version control system). And, the Delete button allows to remove container.

After creation, your container already has the default web application installed. To see that default application, click the link next to container name (in this example the link is The web page appears like in figure below:


On the page that appears, you can see that the default application is just a stub that offers you to upload some code and start working on your own web site.

Deploying Zend Skeleton Application

Next, I will show how to deploy an empty Zend Skeleton Application in the container we have just created.

On the My Containers page, click the container name link to enter into the container’s Dashboard page (in this example, the container’s name is olegkrivtsov). The Dashboard page appears where you can manage your container (shown in figure below):


On the Dashboard page, open the the PHPCloud->Overview tab. Then click the Deploy New Application link.

In the pop-up window that appears, you need to choose application type (in this example, I choose “Empty Zend Framework 2 Application”). Click the Next button.


On the next page (shown in figure below), choose the application name (in this example, I enter the “skeleton” name).


Here, you will also need to enter the path to the application which is the part of the URL that allows to open your web app in a web browser. In this example, I use the “skeleton” path. As you are ready, click the Deploy New Application button.

Next, you can see you application in the list of installed application on the Dashboard page. Clicking the application name opens it in the web browser (see the figure below):


Alternatively, you can see your installed skeleton application in the web browser by entering the following URL into its address bar: In the URL, the “olegkrivtsov” part is the name of the container, and the “skeleton” is the path to the web application.

Congratulations! We have just deployed our Zend Skeleton Application from scratch and ready to modify its code and develop our own ZF2 based web site.

Using GIT to Update Code in Container

In the last part of this post, I will show how you can connect to your container with the Git client and update the code.

When using Git, you typically make a clone of the code stored in the container, work on it and commit your changes locally, and then push the code back to the container. The Git version control system stores the complete history of the changes you made, so you can roll back your container to any of its previous states. This makes it easy to safely update the code and work on large web applications in a team.

If you don’t have a Git client on your machine yet, I would recommend you to install Tortoise Git that is a convenient graphical Git client for Windows.

To connect to the Git code repository associated with your PHPCloud container, you will need two things: the URL of the repository and a private RSA key.

First, we will obtain the private key. On the Dashboard page, click the Access Keys page. The Access Keys page appears where you can generate a new key pair (see figure below for example).


To do that, in the dropdown list, select the PPK (WinSCP and PuTTY on Windows) option and click the Generate New Keypair button. The PPK private key file then will be downloaded to your machine.

To obtain the Gir repository URL, on the Dashboard page, click the application name (“skeleton” in this example). The popup pane appears (shown in figure below).


On that pane, click the GIT Repository tab. Here you can see two URLs: the first one is the URL for accessing your repository via SSH (recommended), and the second one is for accessing it via HTTPS. You need to copy the first URL.

Next, in Windows Explorer, create an empty directory somewhere and name it, say, “phpcloud”. In Windows explorer, enter the empty directory you have just created and right click on empty space. The context menu appears. Choose the “GIT Clone…” item from the menu. The Git Clone windows appears (shown in figure below).


In the Git window, enter the URL of the repository and pick the PPK file.
Then click the Clone button. The cloning progress window appears:


Once the clone process finishes, you can browse the source code of the skeleton application in Windows explorer (see below for example).


With Tortoise Git, you can make changes, commit them locally and push the changes back to the PHPCloud. In other words, you can work on your web application, apply changes to the code, and see the result in your web browser, the same way you usually do.


I am a software developer currently living in Tomsk, Russia. I received a PhD degree in Computer Science from Tomsk Polytechnic University in 2010. I have been professionally developing C/C++ and PHP software since 2005. I like contributing to open-source and writing programming articles for popular web resources, like CodeProject. Besides writing, I love skiing and watching Formula-1.

Tagged with: , , , , ,
Posted in PHP, Zend Framework 2
One comment on “PHPCloud — A New Easy Way to Run ZF2 Web Applications

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow ValuableThing on
%d bloggers like this: