anynines website



Tejesh Mallikarjuna

Published at 24.01.2019

How-To’s & Tutorials

Wordpress – How to Deploy It on a9s PaaS

anynines recently released its a9s MySQL Data Service offering on our a9s Public PaaS. Most of the bloggers around the world use WordPress as their blogging tool.

Now, it is time for all bloggers to host WordPress on our a9s Public PaaS. Let us walk down with all the required steps to install WordPress in this blog post.

Table of Contents


We create an a9s Data Service instance to connect the WordPress application with a MySQL server.

Let us consider an audience with no technical knowledge and also, most of the WordPress users have no technical background and come without any prior knowledge of Cloud Foundry. Come on, let’s deploy a WordPress application smartly on a9s Public PaaS with few steps and experience the magic practically.

Before going ahead to further steps, we would like to assume all the audience have knowledge about command line terminal of any Operating System.

Prerequisites to host WordPress on a9s Public PaaS

To use our a9s Public PaaS to host a WordPress application, you need the following prerequisites:

Choose your a9s MySQL Service Plan

After user creation, run cf login. Please enter your credentials, select your organization name and space name.

Code Example

$ cf login

Now, we can view all the services available at anynines CF marketplace.

a9s MySQL offers various service plans.

After login, run cf marketplace.

Code Example

1$ cf marketplace -s a9s-mysql101
3Getting service plan information for service a9s-mysql101 as your_username...

service plan


free or paid


a medium replica set



a small replica set



a medium single instance



a small single instance


From the above list, we can choose the required service plan for deploying WordPress. mysql-single-small plan is more than sufficient to deploy WordPress and it is free!

For any custom requirements and queries, please feel free to contact our support.

Create your a9s MySQL Service Instance

To provision a MySQL database, run cf create-service.

Code Example

1$ cf create-service a9s-mysql101 mysql-single-small my-mysql-service

Depending on your infrastructure and service broker utilization, it may take several minutes to create the service instance.

Run cf services to view the creation status. This command displays a list of all your service instances. To view the status of a specific service instance, run

Code Example

1$ cf service NAME-OF-YOUR-SERVICE


Code Example

1$ cf services
Deploy your WordPress Application

After your database is created, we have to follow the below three steps to complete the deployment process:

  1. Download WordPress latest source code.
  2. Modify required configuration.
  3. Start Application and verify.
Download WordPress latest source code.

Download the latest WordPress source code.

Code Example

1$ curl -L -o

Now, extract them and remove zip file:

Code Example

1$ unzip && rm
Modify your required configuration

Let us modify the required configuration before pushing the application into our a9s Public PaaS.

Create manifest.yml file by using any text editor with the below  contents inside WordPress directory.

Please edit with your desired application name and route sections shown below. Also, edit services section with the above-created service name.

Code Example

1applications:2- name: <your_app_name>
3  memory: 128M

4  path: .

5  route:

6  buildpack: php_buildpack

7  services:8    - <your_mysql_instance_name>

Now, copy the sample configuration file.

Code Example

1$ cp wordpress/wp-config-sample.php wordpress/wp-config.php

Now edit wordpress/wp-config.php, replace the database configuration lines with the following:

Code Example

1// ** Read MySQL service properties from _ENV['VCAP_SERVICES']
2$services = json_decode($_ENV['VCAP_SERVICES'], true);
3$service = $services['a9s-mysql101'][0];  // pick the first MySQL service</em>
5// ** MySQL settings - You can get this info from your web host ** //
6The name of the database for WordPress */
7define('DB_NAME', $service['credentials']['name']);
9/** MySQL database username */
10define('DB_USER', $service['credentials']['username']);
12/** MySQL database password */
13define('DB_PASSWORD', $service['credentials']['password']);
15/** MySQL hostname */
16define('DB_HOST', $service['credentials']['hostname'] . ':' . $service['credentials']['port']);
18/** Database Charset to use in creating database tables. */
19define('DB_CHARSET', 'utf8');
21/** The Database Collate type. Don't change this if in doubt. */
22define('DB_COLLATE', '');

Configure the remainder of wp-config.php as you normally would for a new WordPress site.

Before adding extension files, let us create directories inside WordPress directory.

Code Example

1$ mkdir -p .bp-config/php/php.ini.d

Now, create extensions file .bp-config/php/php.ini.d/wp-extensions.ini by using any text editor with the below contents:

Code Example

Also, create the file .bp-config/options.json and add the following contents:

Code Example

2"WEBDIR": "wordpress",

You can also use other PHP versions like replacing PHP_VERSION value with PHP_70_LATEST for PHP 7.0 and so on.

Start your Application and verify

Let us start the application by pushing the application into a9s Public PaaS by using cf push

Code Example

1$ cf push

Now, verify the application by using cf app:

Code Example

1$ cf app
3Showing health and status for app wordpress in org your_org_name / space your_space_name as ...
5name:              <your_app_name>
6requested state:   started
7instances:         1/1
8usage:             128M x 1 instances
10last uploaded:     Tue 30 Oct 11:18:26 CET 2018
11stack:             cflinuxfs2
12buildpack:         php_buildpack
14state since                                 cpu memory disk details
15#0   running   2018-10-30T10:19:11Z   0.2% 96.5M of 128M 234.8M of 512M

Visit http://<your_app_name> to set up your WordPress application.


WordPress application deployment can be done with only a few steps on our a9s Public PaaS. This is going to save a lot of time in deployment and configuring your WordPress web server all by yourself.

I hope you are all able to set up WordPress with the above step by step tutorial. Also, please note that Cloud Foundry uploads all of your plugin code inside containers and if you scale your applications or do restage your application, then you have to place plugin code in local source code to get the desired state.

© anynines GmbH 2024


Privacy Policy


© anynines GmbH 2024