We hosted an AWS 101 webinar earlier this month, during which we did a live walk-through of how simple it is to get your PHP applications up and running on the enterprise cloud platform AWS.
This article will walk you through the process of getting started with AWS using a Zend PHP server. But first, let's address a frequently asked question.
Does AWS Support PHP?
Yes, there are numerous ways to deploy PHP applications on AWS. These options range from using a minimal OS image to spin up an instance and then installing the LAMP stack on top of it to using images that come pre-installed with everything needed to run a web application.
Easy Steps to Host a PHP Website on AWS
Zend Server AWS machine images (AMI), which come pre-installed with Zend Server, are one of the quickest ways to get your PHP app into an AWS machine (but without MySQL server). If your application requires a MySQL server (which many PHP applications do), we recommend AWS RDS, which offers MySQL as a service.
Aside from the standard PHP and Apache stack, Zend Server adds value with the following components:
- Z:Ray: allows displaying all information about requests processed by PHP in real time
- Deployment: automates deployment of PHP applications
- Monitoring: centralized interface to PHP events
- Data cache: PHP extension that allows caching data in memory or on disk
- Page cache: cache full page that was generated by PHP
- Job queue: background execution of requests to any URL
- Session clustering: allows sharing of PHP sessions between cluster nodes
Zend Server images on AWS Marketplace provide a choice of the following options:
- Operating system: RHEL7 or Ubuntu 14.04 (CentOS is on our roadmap)
- PHP versions: 5.5 or 5.6 (there are a few images with PHP 5.3/5.4 as an LTS version and PHP 7 will be supported soon)
- Zend Server editions: developer, professional, and enterprise
Zend Server for AWS PHP + MySQL
Ready to get started with AWS PHP + MySQL?
As a follow-on to the webinar, we have pulled together this step-by-step guide covering how to start a simple instance of Zend Server on AWS, add RDS MySQL service and connect to it, and launch WordPress using Zend Server deployment.
Step 0 - AWS Vocabulary and Security Basics
Let’s start with a simple vocabulary of common terms that are used when discussing AWS:
- AWS (Amazon Web Services)
-
- EC2 (Elastic Compute Cloud): an AWS service that provides computing resources
-
- AMI (Amazon Machine Image): a filesystem image with some metadata like type of OS in image and type of virtualization to use when starting new server
-
- Instance: a Virtual Machine running on EC2 using some AMI
-
- Instance type: a combination of CPU, memory, storage, and networking capacity
-
- RDS (Relational Database Service): an AWS service that provides many relational databases (supports, but not limited to, MySQL)
-
Step 1 - Launching Zend Server on AWS
There are two ways to launch Zend Server on AWS. First is to use AWS Marketplace website (option A) and launch Zend Server from there. Second is to use Marketplace inside AWS Console (option B). We will cover both ways here.
Option A: Launch Zend Server using AWS Marketplace website
- Open AWS Marketplace website
- Sign in or create AWS account by clicking relevant link on top of page
-
- Type ‘Zend Server’ in the search bar and press Enter
-
- In the search result locate Zend Server with relevant PHP version, edition, and operating system. For this guide please select 'PHP 5.6 - Zend Server Developer Edition (Ubuntu)'.
-
- On the product page click on "Continue" button located on the right
-
- Configure and customize the launch settings of Zend Server instance.
-
- Version: version of Zend Server AMI to use. It’s recommended to always use latest version
-
- Region: which region Zend Server instance should be started
-
- Instance type: how much CPU/memory/Storage you want for your instance
-
- VPC settings: which VPC and subnet instance is started
-
- Security group: security group for instance, you can select existing security group or let AWS create new security group with default rules for Zend Server (recommended)
-
- Key pair: which SSH key pair should be installed on this instance
-
Review the launch settings and click on "Accept Software Terms & Launch with 1-Click" button, After the first launch this button will be named "Launch with 1-Click".
- Login to AWS Console to see the new instance and get its’ details
Option B: Launch Zend Server using AWS Console
- Login to AWS Console
- Open EC2 Console
- On dashboard click on "Launch Instance"button
- In the wizard presented select AWS Marketplace tab on the left
- Enter 'Zend Server' in the search bar
- Select relevant Zend Server product with relevant PHP version, edition, and operating system and click Continue button in product summary that is shown. For this guide please select 'PHP 5.6 - Zend Server Developer Edition (Ubuntu)'.
- Select instance type
- On steps 3, 4, 5 various instance settings can be configured. For this guide, skip them by clicking “5. Tag Instance” link on top.
- Enter friendly name for your instance that will be used to identify it and click on "Review and Launch" button
- Review new instance settings and click "Launch"
- Either select an existing key pair (and acknowledge you have access to it) or create a new one and click "Launch Instances"
- Wait while the instance is created and then click on "View Instances" button at the bottom of a page Launch Status
Bootstrap Zend Server to get Zend Server ready for work
After completing either option A or B, you must prepare Zend Server for use. We must bootstrap it using a simple wizard. To accomplish this, we launch the Zend Server UI, which is accessible via a web browser on the instance's port 10081.
We must determine the instance's public DNS (which we will use in this guide) or public IP address. To access the Zend Server UI, we'll also need the instance ID. The Zend Server UI is protected by default, so you must enter the instance ID as login and password, but once you bootstrap Zend Server and set the admin password, you will not have to use it again.
Follow these steps to find “Public DNS” and “Instance ID” of your instance:
- Open AWS Console
- Enter EC2 Console
- In the menu on the left click on “Instances” link
- Locate your instance in the list of instances and click on it
- On the bottom pane you will see information about the instance shown in 2 columns
- “Public DNS” field is on top of right column
- “Instance ID” field is on top of left column
Now that we have the instance's public DNS name, we can open a browser and enter the following address to access the Zend Server UI: www.Public DNS>:10081/
When you first launch Zend Server UI, you will be prompted to authenticate. Enter the "Instance ID" you discovered earlier as both your login and password.
You will then be presented with a wizard that will walk you through the process of installing Zend Server in a few simple steps. After completing the wizard and successfully bootstrapping, your Zend Server is fully operational.
It should be noted that the bootstrap process can be fully automated by providing user data to the instance.
To be Continue ...