Skip to Content
Author's profile photo Rui Nogueira

Running Drupal on beta of HCP Cloud Foundry services

In previous blog posts I’ve already talked about the availability of the beta for the “SAP HANA Cloud Platform, starter edition for Cloud Foundry services” and SAP’s strategy behind the usage of Cloud Foundry and OpenStack on SAP HANA Cloud Platform.

In this blog post I want to become a bit more hands-on and explain how you can install the free content management system Drupal on the beta of the HCP Cloud Foundry services.

Drupal runs on PHP and also needs to have a dabase underneath to persist the content you want to put on the Drupal instance. In our example we’ll provide a PostgreSQL service instance that’ll also run on the beta.

Table of contents

Getting an account and Drupal

Step1 – Get account and Cloud Foundry tooling

First, get an account for the free beta offering “SAP HANA Cloud Platform, starter edition for Cloud Foundry services“.

Just follow the instructions in the official documentation and first sign up, secondly you need to get the Cloud Foundry command line interface, and log on to your account.

Screen Shot 2016-06-02 at 13.01.05.png

Step2 – Get Drupal

Now you need to download Drupal from the Drupal download page. I’ve taken drupal-7.43

Screen Shot 2016-06-02 at 13.02.58.png

Prepare Drupal

Step3 – Unzip Drupal installation file

Now unzip the downloaded Drupal file in a separate directory and switch over to that directory.

We’ll have to do some modifications to the Drupal files.

Those of you who are lazy and know how to use Git can take the necessary files out of a git repository I’ve created and simply overwrite the Drupal files with the files from the git repository.

All others please go now through step 4 – 8.

Step4 – Setup the PHP Buildpack Configuration

Now create a folder called .bp-config.

This is a standard folder to configure the PHP buildpack we’ll need to run Drupal.

Switch to the .bp-config folder, create a file called options.json in that folder, copy-and-paste the content from here into that file and save it.

This file will later on tell the PHP buildpack that it needs to activate some specific PHP extensions that Drupal needs. Thi

After saving the file please switch back to the root folder of the Drupal directory!

Step5 – setup PHP.ini

Add the content from here to file php.ini and save the file. These settings will activate the extensions we’ve defined in step 4.

Again: this file needs to be in the root folder of the Drupal directory!


Step6 – Create settings-php for Drupal

Now switch to the sub folder sites/default.

Create a file called settings.php


Step7 – Modify settings.php for usage in HCP CF beta account

Copy and paste the code from here into the settings.php file.

This change will allow the Drupal installer to automatically detect the database instance we’ll be setting up in the next steps and extract the necessary details out of the environment variables of your Drupal app on your Cloud Foundry account. If you want to learn more about it have a look at the official Cloud Foundry documentation for the environmental variables.

After saving the file please switch back again to the root folder of the drupal directory!

Configure Cloud Foundry services


Step8 – Prepare your application manifest

The last preparational task will be the creation of a manifest.yml file in the Drupal root folder.

This file is not really needed as you can provide most of the parameters already via the Command Line Interface. Nevertheless it’s useful to have it, as you can post there important information around the deployment of your application. You can define in the file what the name of your app should be, which buildpack(s) you want to use for it, how much memory and disk space you want to assign to the app, etc… Checkout the corresponding documentation on Cloud Foundry for more details.

Please create the manifest.yml file in the Drupal root folder.

Now copy-and-paste the code you get here into the manifest.yml file.

Adapt the name of the application if you want to have another name for the app and save the file.

We are now ready with all the preparations and will run a few commands with the Cloud Foundry command line tool.

Step9 – Create PostgreSQL instance

First we need to create a PostgreSQL service instance with the following command:

cf create-service postgresql v9.4-container mypostgresql

You can see, that the name of the instance mypostgresql is the same like described in the manifest.yml we’ve created before in step 8.

Step10 – Push app to the cloud

Now we push the Drupal installation to your account with the following command:

cf push

Be sure you are on the root folder of the Drupal root folder prior running the command.

The output will look similar to this:

Screen Shot 2016-06-03 at 10.14.24.png

Step 11 – Checkout URL of app
Once the command is ready you can get the URL with the command

cf apps

The URL of the app will be provided under the urls column

Screen Shot 2016-06-03 at 10.19.27.png

Install Drupal in your account

Step12 – Call the Drupal installer

Now copy-and-paste the URL in your browser and add


at the end of the URL.

You can now go through the Drupal installation. Those of you who want to learn more around Drupal can read through the Getting-Started page of Drupal for more details.

Screen Shot 2016-06-03 at 10.22.12.png

Step13 – Configure Drupal installation

If all went all you should only have to click once on Save and Continue in the initial screen and after selecting the language you should already been on the Configure site step. As we configured the database detail already in step 7 inside the settings.php you don’t have to provide the credentials of your PostgreSQL instance manually. Those settings are fetched from the VCAP_SERVICES variable of your app.

In case you need to provide the database connection details something went wrong in step 7. Did you really copy-and-paste the complete code that I’ve provided?

Screen Shot 2016-06-03 at 10.23.44.png

Step14 – Setup the content in your Drupal system

After having provided all the details you should be able to jump to your Drupal instance by clicking on the “Visit your new site.” link.

That link is actually the URL of the app you’ve pushed to your beta account.

Screen Shot 2016-06-03 at 12.36.11.png

Now you can start configuring Drupal to your needs.

Screen Shot 2016-06-03 at 10.30.04.png

And now?

After Drupal is running, you can have a more detailed look at the changes we’ve made to the standard Drupal installation in steps 4 – 8.

You might also considering looking into the cockpit of your HCP CF services beta account to cross-check the application information and to also have a look at the environment variables we’ve talked about in step 7.

Screen Shot 2016-06-03 at 14.22.10.png

Also checkout the service bindings and the service provisioning, too. Most of what you have done with the Cloud Foundry Command Line Interface can also be done in your account cockpit. Just play around a bit and learn how the application management works.

Hope this helped you a bit to use the “SAP HANA Cloud Platform, starter edition for Cloud Foundry services“.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Aliaksandr Shchurko
      Aliaksandr Shchurko


      Author's profile photo Guy Soffer
      Guy Soffer

      Thanks for the great blog.

      I tried to follow the steps and when I do "cf push", the files get uploaded but after "Binding service..." and the OK in the console, I get "timeout connecting to log server, no log will be shown" and I don't see the "Download app package...". The app is started but returns 500 server error.

      The errors in the app logs are:

      5 Jul 2016, 09:55:32 STDERR [STG/0]

      Cloning into '/tmp/buildpacks/php-buildpack'...

      5 Jul 2016, 09:55:33 STDERR [STG/0]

      Cloning into 'compile-extensions'...


      Author's profile photo Andreas Morf
      Andreas Morf

      Hi Rui,

      thanks for the good explanations. In my case after I did "cf push", I cannot execute the "app-url/install.php" - it gives me a HTTP500 error message (Internal Server Error). Any idea how to proceed?

      The app is running under amorfsdrupal and its health status seems to be ok.

      Author's profile photo Eberhard Reiner
      Eberhard Reiner


      I also only get a server error with the installation url::

      Internal Server Error

      The server encountered an internal error or misconfiguration and was unable to complete your request.

      Please contact the server administrator at admin@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

      More information about this error may be available in the server error log.

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      same error for me too!

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      I'll check it and see whether I can reproduce the behavior on my side.



      Author's profile photo Former Member
      Former Member

      I get the 500 Internal Servier error as well. No errors in the command line output, the app is running, all seems to be fine. But the error is still there.

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      Please try to remove the .htaccess file in the root folder of the drupal installation. That should do the trick.


      PS: Please remember that this blog post is here to demo how to use PHP and persistence in Cloud Foundry. It's not meant as a how-to guide for a productive Drupal setup.

      Author's profile photo Eberhard Reiner
      Eberhard Reiner

      Late response but after deleting .htaccess it works now!


      Best regards

      Author's profile photo Former Member
      Former Member

      Nice article. It really helped me and my colleagues to come up with a solution for running Drupal 8 on Pivotal Cloud Foundry.

      You may find it here

      It's not spam (that's what a spammer would say), and I hope it may help someone out there. All the best!