14 January 2017 - Upkar Lidder Open Issue

Wordpress on Bluemix

IBM Bluemix is a cloud platform as a service (PaaS) developed by IBM. WordPress is a free and open-source content management system (CMS) based on PHP and MySQL.


  1. CloudFoundry CLI
  2. IBM Bluemix account

Steps in Summary

  1. Download wordpress
  2. Log into CF using the CLI
  3. Create mysql service
  4. Configure wordpress
  5. Create application using the community php buildpack
  6. Bind mysql to the application and confirm configuration
  7. Install wordpress
  8. Optional — Configure wordpress site
  9. Optional — use media storage

Steps in Detail

Step 1. Download wordpress

Download wordpress from here (I used 4.6.1 as there was a problem with the latest release 4.7 at the time of writing this post)

Step 2.CloudFoundry API

Set cloudfoundry API to the bluemix instance

>> cf api https://api.ng.bluemix.net 
Setting api endpoint to https://api.ng.bluemix.net...
API endpoint: https://api.ng.bluemix.net (API version: 2.54.0)

Log into Bluemix

>> cf login
API endpoint: https://api.ng.bluemix.net
API endpoint:   https://api.ng.bluemix.net (API version: 2.54.0)
User:           xxx
Org:            xxx
Space:          dev

Step 3. Create mysql service

The following mysql service is offered at the time of the writing. Note that mysql is provided as an experimental service. Experimental runtimes and services might be unstable or change frequently, and might be discontinued at short notice.

service   plans   description
mysql     100     MySQL database

Create the service:

>> cf create-service mysql 100 mysql-wordpress
Creating service instance mysql-delete in org PRM / space dev as xxx@us.ibm.com...

Step 4. Configure Wordpress

Step 4.1: wp-config.php

get from here.

Step 4.2: add wp-salt.php

to ensure extra security. These salts are used to securely hash the different passwords and cookies used across the site. You can randomly generate the keys at wordpress key generator site. Copy the content of the site into wp-salt.php and save in the same directory as wp-config.php.


Prepend the file with <?php


Step 4.3: options.json

copy options.json from here into .bp-config folder

>> mkdir .bp-config
>> touch .bp-config/options.json

Add the following to the options.json file. These extensions are needed for the site to function.

  "PHP_EXTENSIONS": ["bz2", "zlib", "curl", "mcrypt", "mbstring", "mysqli", "gd", "zip"]

Step 5. creat application

Create application using the community php buildpack. I am calling the application “mywordpress-upkar”

>> cf push mywordpress-upkar -b https://github.com/dmikusa-pivotal/cf-php-build-pack.git --no-manifest --no-start

Step 6. Bind service

Bind mysql to the application and confirm configuration in your wp-config.php.

cf bind-service

cf bind-service mywordpress-upkar mysql-wordpress

Grab the mysql service name from the environment variable and update wp-config.php file with the same.

$mysql_config = $services_json[“mysql-5.5”][0][“credentials”];

Replace mysql-5.5 with the mysql credentials in your apps environment variable. You can see a service credentials using the following command

cf env (cf env mywordpress-upkar)

In this case, I need to replace “mysql-5.5” with “mysql” as shown by the env output below.

      “mysql”: [
            “credentials”: {

Push the code changes to Bluemix.

cf push mywordpress-upkar

The push command also starts the application. If the application is not started, you can start is using

cf start mywordpress-upkar

Step 7. Install wordpress

The first time you launch your site on bluemix, you will be asked to install wordpress. The URL will look like

Wordpress on Bluemix

Step 8. Optional, Configure wordpress

upload_max_filesize = 10M
post_max_size = 10M
max_execution_time = 300

You can see the changed upload limit in the media section

Wordpress on Bluemix

Step 9. Optional, use media storage

We have a mysql database to support wordpress, but all the media files are stored in the filesystem. You can look at this plugin to store media content on bluemix object-storage database.

Open Issue

Back home