Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (38 sloc) 2.01 KB

PHP Support


PHP applications are deployed using Apache and mod_php. For each CloudFoundry instance of the application, an Apache instance is started.

Demo: Installing Wordpress

The Wordpress CMS can be run using CloudFoundry PHP support with very minimal changes.

Steps to get the application to run:

  1. curl -O

  2. tar -xzf latest.tar.gz

  3. rm latest.tar.gz

  4. cd wordpress

  5. echo "<?php" > wp-salt.php

  6. curl >> wp-salt.php

  7. Create wp-config.php, and set it to:

             $services = getenv("VCAP_SERVICES");
             $services_json = json_decode($services,true);
             $mysql_config = $services_json["mysql-5.1"][0]["credentials"];
             // ** MySQL settings from resource descriptor ** //
             define('DB_NAME', $mysql_config["name"]);
             define('DB_USER', $mysql_config["user"]);
             define('DB_PASSWORD', $mysql_config["password"]);
             define('DB_HOST', $mysql_config["hostname"]);
             define('DB_PORT', $mysql_config["port"]);
             define('DB_CHARSET', 'utf8');
             define('DB_COLLATE', '');
             define ('WPLANG', '');
             define('WP_DEBUG', false);
             $table_prefix  = 'wp_';
             /* That's all, stop editing! Happy blogging. */
             /** Absolute path to the WordPress directory. */
             if ( !defined('ABSPATH') )
                     define('ABSPATH', dirname(__FILE__) . '/');
             /** Sets up WordPress vars and included files. */
             require_once(ABSPATH . 'wp-settings.php');
  8. vmc push wordpresscf --url -n

  9. vmc create-service mysql --bind wordpresscf

  10. Visit and enjoy your Wordpress install!