Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.bp-config
README.md
wp-config.php

README.md

bluemix-wordpress

WordPress is a free and open source blogging tool and a content management system (CMS) based on PHP and MySQL which runs on a web hosting service. Features include a plug-in architecture and a template system. WordPress is completely customizable and can be used for almost anything. You can use Wordpress as a foundation of your web application to call social data APIs. In order to have Wordpress work on the IBM codename: BlueMix Platform, do the following:

    1. Download a current stable version of Wordpress from http://wordpress.org/download/.
    2. Untar or unzip the download and change to the base directory, usually "wordpress".
    3. WordPress Security Keys are a set of random variables that improve encryption of information stored in the user’s cookies. Self-hosted WordPress deploys do not have the Security Keys defined by default. When you create and use a set of random variables, you're changing the way that WordPress encrypts cookie data which in turn helps improve the security of the site.  We will populate a separate file called wp-salt.php with a set of random variables generated using the WordPress Online Salt Generator found @ https://api.wordpress.org/secret-key/1.1/salt/ and then require its inclusion within the wp-config.php file.
    4. From the base directory (e.g. "wordpress"), run
      #Create a file named wp-salt.php and append it with the string <?php 
      echo "<?php" > wp-salt.php
    5. Followed by ....
      #Fetch a series of automatically generated define statements and append it to the wp-salt.php file  
      curl https://api.wordpress.org/secret-key/1.1/salt/ >> wp-salt.php
    6. One of the most important files in a WordPress installation is the wp-config.php file. This file is located in the root of a WordPress file directory and contains the WordPress website's base configuration details, such as database connection information.  For the BlueMix platform, database connection information is dynamically generated during service instantiation and shared within environment variables.  Therefore, a config file structured to read the MySQL environment variable details is necessary. Insert or replace the wp-config.php within the WordPress directory with the one from this github repository

    7. Using the cloud foundry v6 cli, login to BlueMix and install Wordpress with a PHP buildpack.  
      <<random number>> is user provided input.
      # Step 0: cf login -a <api target url> 
      $ cf login -a https://api.ng.bluemix.net
      # Step 1: cf create-service <service name> <service plan type> <unique service instance name>
      $ cf create-service mysql 100 mysql-wordpress-service

      # Step 2: cf push <unique application name> -b <url to php buildpack> --no-manifest (No manifest.yml present) --no-start (Don't start application after push)
      # Buildpack choices:
      # Basic - https://github.com/heroku/heroku-buildpack-php.git
      # ZLib Support (Gzip compression)- https://github.com/cyberdelia/heroku-buildpack-php.git $ cf push mysql-wordpress-<<random number>> -b https://github.com/heroku/heroku-buildpack-php.git --no-manifest --no-start

      # Step 3: cf bind-service <unique application name used in Step 2> <service instance name used in Step 1>
      $ cf bind-service mysql-wordpress-<<random number>> mysql-wordpress-service

      # Step 4: cf start <unique application name used in Step 2> (Start application)
      $ cf start mysql-wordpress-<<random number>>
    8. Once the push is finished, navigate to http://yourapp.ng.bluemix.net/wp-admin/install.php to set up wordpress.
    9. That's it!.
Please note:  BlueMix does NOT provide persistent file storage. In order to have custom themes and plugins persist with your instance of Wordpress, you should save those themes and/or plugins within the application folder prior to pushing your application.

FAQ

Q:  What does the text content look like when issuing the command curl https://api.wordpress.org/secret-key/1.1/salt/
A:  Example.  Data collection changes with each subsequent refresh
WordPressSecretKeySaltExample
Q:   BlueMix indicates that my application is running.  But I'm getting a blank page when browsing to the application route and I get a 404 "/install.php not found error".  When I look into BlueMix's stdout.log file, I see messages about a PHP Parse error:  syntax error, unexpected ' " '  (quote character).

WordPressSaltPHPWithQuotesError

A:  While rare, this can happen when double quote characters are inadvertently stored during the creation of wp-salt.php (Step #3).  Inspect the file and remove any double quote characters that may be wrapping the <?php text in the first line.

Q:  After following the steps, I keep seeing the error Your PHP installation appears to be missing the MySQL extension which is required by WordPress. What gives?

A: This is caused by a change in how the https://github.com/dmikusa-pivotal/cf-php-build-pack.git buildpack behaves. See here. To resolve, be sure to create a new folder in the root of your project called .bp-config *Note:This folder begins with a period. Within this folder, create an options.json file and populate it with a JSON array similar to this.  

You can’t perform that action at this time.