{"id":47630531,"url":"https://github.com/cloud-gov/wordpress-example","last_synced_at":"2026-04-01T23:22:34.823Z","repository":{"id":37994249,"uuid":"47581009","full_name":"cloud-gov/wordpress-example","owner":"cloud-gov","description":"CloudFoundry PHP example application:  Wordpress","archived":false,"fork":false,"pushed_at":"2026-02-27T16:42:08.000Z","size":6767,"stargazers_count":2,"open_issues_count":2,"forks_count":5,"subscribers_count":88,"default_branch":"main","last_synced_at":"2026-02-27T21:07:31.155Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cloudfoundry-samples/cf-ex-wordpress","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloud-gov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-12-07T21:41:47.000Z","updated_at":"2026-02-27T17:16:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cloud-gov/wordpress-example","commit_stats":null,"previous_names":["cloud-gov/wordpress-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloud-gov/wordpress-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-gov%2Fwordpress-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-gov%2Fwordpress-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-gov%2Fwordpress-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-gov%2Fwordpress-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloud-gov","download_url":"https://codeload.github.com/cloud-gov/wordpress-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-gov%2Fwordpress-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-01T23:22:34.241Z","updated_at":"2026-04-01T23:22:34.814Z","avatar_url":"https://github.com/cloud-gov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloud.gov PHP Example Application:  WordPress\n\nThis is an example application which can be run on cloud.gov using the CloudFoundry [PHP buildpack](http://docs.cloudfoundry.org/buildpacks/php/index.html).\n\nThis is an out-of-the-box implementation of WordPress. It's an example of how common PHP applications can easily be run on cloud.gov\n\n1. [Installation](#installation)\n1. [Administering your WordPress site](#administering-your-wordpress-site)\n1. [Recommendations](#recommendations)\n\n## Installation\n\n\u003e **Please note:** If you are deploying from a Windows machine, you may encounter issues with [Windows changing the file line endings](https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings).\n\u003e\n\u003e To avoid this issue, [follow these instructions](https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings#how-to-convert) to convert the file line endings from Windows-style to UNIX-style.\n\u003e\n\u003e If you are having this issue, you will see errors like `/bin/bash^M: bad interpreter: No such file or directory` in your application logs.\n\n1. Clone this repo.\n\n    ```bash\n    git clone https://github.com/18F/cf-ex-wordpress.git cf-ex-wordpress\n    cd cf-ex-wordpress\n    ```\n\n1. Create a service instance of a MySQL Database:\n\n    ```bash\n    # note: if this is for a production environment, use one of the plans with `-redundant` in the plan name for better availability\n    # run `cf marketplace -e aws-rds` to see available database plans\n    cf create-service aws-rds micro-mysql mysql-db\n    ```\n\n    See the [cloud.gov website page on database services.](https://cloud.gov/docs/services/relational-database/) for more information.\n\n1. Create a service instance of S3 storage:\n\n    ```bash\n    # run `cf marketplace -e s3` to see available S3 plans\n    cf create-service s3 basic-public s3-storage\n    ```\n\n    **Note**: cloud.gov does not have persistent local storage so you'll need to rely on S3 for storing any files uploaded to WordPress. Sandbox accounts cannot create S3 storage services. Consider upgrading to a prototyping package if you need to do this.\n\n    [See the cloud.gov website page on S3 services for more information.](https://cloud.gov/docs/services/s3/)\n\n1. Copy the example `manifest.yml.example` to `manifest.yml`. Edit the `manifest.yml` file:\n\n    - Change the `name` and `host` attributes to something unique for your site.\n    - Under `services:` change\n      - `mysql-db` to the name of your MySQL service you created in Step 2.\n      - `s3-storage` to the name of your S3 service you created in Step 3. Or delete this line if you're not using S3.\n    - The memory and disk allocations in the example `manifest.yml` file should be [sufficient for WordPress](https://developer.wordpress.org/apis/wp-config-php/#increasing-memory-allocated-to-php) but may need to be adjusted depending on your specific needs.\n\n1. Deploy the app with a no start command:\n\n    ```bash\n    cf push --no-start\n    ```\n\n    This will download and install WordPress, configure it to use your MySQL service, and install all your plugins and themes but will not start the application on cloud.gov.\n\n1. Copy the example `setup.sh.example` to `setup.sh` and then:\n1. Update `setup.sh` and replace the placeholder `YOUR-KEY` with the values from the [WordPress Secret Key Generator](https://api.wordpress.org/secret-key/1.1/salt/).\n1. Update `setup.sh` to set the values that will be used when installing your site:\n\n    - `SITE_NAME`: name for your Wordpress site\n    - `SITE_URL`: URL for your website, which should either be the URL ending in `app.cloud.gov` printed by CloudFoundry after `cf push` or your custom agency domain (e.g. `agency.gov`)\n    - `ACCOUNT_NAME`: name for your site's admin user account\n    - `ACCOUNT_EMAIL`: email address for your admin user account\n    - `ACCOUNT_PASS`: password for your site's admin user account\n\n1. Make sure to `chmod +x` the file:\n\n    ```bash\n    chmod +x setup.sh\n    ```\n\n1. Run it and pass in the name of your app that you set in `manifest.yml`:\n\n    ```bash\n    ./setup.sh mywordpress\n    ```\n\n    This will set these values as environmental values in the cloud.gov environment. **Note - Make sure to include the leading and closing `'` characters to avoid errors escaping special characters**.\n\n1. Push the Wordpress application to CloudFoundry:\n\n    ```bash\n    cf push\n    ```\n\n    On `cf push`:\n\n    - The server downloads and runs the [PHP buildpack](http://docs.cloudfoundry.org/buildpacks/php/index.html) which installs HTTPD and PHP\n    - The buildpack includes the `composer` extension, so it sees `compser.json` and installs the defined packages from there, including Wordpress, the WP CLI, and some plugins/themes\n    - [A custom script](./scripts/bootstrap.sh) copies the Wordpress files installed by `composer` into the web root for the application and installs Wordpress using the environment variables configured in `setup.sh`\n    - The platform starts the application\n\n    Now you have a WordPress site. You should see output like this in your terminal:\n\n    ```shell\n    Waiting for app mywordpress to start...\n\n    Instances starting...\n    Instances starting...\n    Instances starting...\n\n    name:              mywordpress\n    requested state:   started\n    routes:            mywordpress.app.cloud.gov\n    last uploaded:     Fri 27 Feb 09:50:54 EST 2026\n    stack:             cflinuxfs4\n    buildpacks:\n            name                                                version   detect output   buildpack name\n            php_buildpack                                       5.0.4     php             php\n\n    type:            web\n    sidecars:\n    instances:       1/1\n    memory usage:    128M\n    start command:   .bp/bin/start\n    ```\n\n    If you go to the URL listed under `urls` you should see a fresh WordPress site.\n\n1. Verify S3 connection:\n\n    This demo uses the [Human Made S3 Uploads plugin](https://github.com/humanmade/S3-Uploads), which automatically uploads files from your WordPress install to S3 and rewrites the URLs for you. The app requires no configuration. The access keys, secret key, and bucket name are stored in the environment configuration and read by the plugin on start.\n\n    ```shell\n    cf run-task mywordpress --command \"wp s3-uploads verify --path='/home/vcap/app/htdocs/'\"\n    ```\n\n    To see that the task ran, run `cf logs APP_NAME --recent` and you should see a line that says:\n\n    ```shell\n    OUT Success: Looks like your configuration is correct.\n    ```\n\n1. Log in and test:\n\n    To test everything is correct, log in to your WordPress site with the credentials you specified when running `wp core install` in the previous step. You should be able to do any admin activities including creating a new post and uploading a media file to it.\n\n## Administering your WordPress site\n\n### Updating WordPress\n\nBy default, this example will the latest version of WordPress specified in `composer.json` and `composer.lock`. To update WordPress or pick up a new version of the PHP builpack, run:\n\n```shell\ncomposer update johnpbloch/wordpress --with-all-dependencies\n```\n\nThen, re-push your application:\n\n```shell\ncf push\n```\n\nUpdate the database schema to support the newer version of WordPress:\n\n```shell\ncf run-task mywordpress --command \"wp core update-db --path='/home/vcap/app/htdocs/'\"\n```\n\nWe **do not recommend** using the wp-admin interface to manage updates to your site.\n\n**Note: We recommend running the latest stable version of WordPress on production sites.** The latest version typically contains important security updates. If you pin the WordPress version, you will need to manually increment this value to upgrade your install. Make sure you follow [the update schedule on wordpress.org](https://wordpress.org/news/category/releases/) to keep up with important security and maintenance releases.\n\n### Themes and plugins\n\nThe Cloud Foundry platform builds apps with ephemeral local storage. This means any changes made to local files on your app will get deleted whenever you `push` or `restage` the app. Make sure your plugins and themes remain installed by installing them through the `composer.json` file using [`composer require`](https://getcomposer.org/doc/03-cli.md#require-r).\n\nBy default, these plugins/themes are included:\n\n- [`S3-Uploads`](https://github.com/humanmade/S3-Uploads): Integrates with S3 for storing uploaded site files\n- `Akismet`: Default spam protection plugin for Wordpress\n- `Create` Wordpress theme\n\nFor plugins or themes you'd normally be able to install from the admin interface, you can list them by name and the version that you want installed. For anything not available through WordPress directly, you can [use composer to require packages from GitHub](https://getcomposer.org/doc/05-repositories.md#vcs). For example, if your site's theme is one you've custom-developed, you can follow those instructions to require it via `composer.json`.\n\nAs with WordPress Core, make sure to watch for and install updates for the plugins/themes that contain security fixes.\n\n### Running WP-CLI commands\n\nWe recommend using Cloud Foundry's \"tasks\" to run `wp-cli` commands. To do this, make sure to specify the WordPress path relative to the `app` directory. Here's how you would run `wp core version` on your cloud.gov container:\n\n```bash\ncf run-task APP_NAME --command \"wp core version --path='/home/vcap/app/htdocs/'\"\n```\n\nThat should print something like:\n\n```shell\nCreating task for app APP_NAME in org ORG_NAME / space SPACE_NAME as USER_NAME...\nOK\n\nTask has been submitted successfully for execution.\ntask name:   98680974\ntask id:     30\n```\n\nRun `cf logs APP_NAME --recent` to see the results and look for the `task name` to see the results. The task will create a container, run your command and then destroy the container after the task exits.\n\n```shell\n2017-09-27T10:54:44.36-0600 [APP/TASK/98680974/0] OUT Creating container\n2017-09-27T10:54:44.81-0600 [APP/TASK/98680974/0] OUT Successfully created container\n2017-09-27T10:54:51.50-0600 [APP/TASK/98680974/0] OUT 6.2.2\n2017-09-27T10:54:51.52-0600 [APP/TASK/98680974/0] OUT Stopping instance 13abb9c4-23fe-4fc6-8b72-dc6676be26b8\n2017-09-27T10:54:51.51-0600 [APP/TASK/98680974/0] OUT Exit status 0\n2017-09-27T10:54:51.52-0600 [APP/TASK/98680974/0] OUT Destroying container\n2017-09-27T10:54:52.92-0600 [APP/TASK/98680974/0] OUT Successfully destroyed container\n```\n\nConsider using [continuous integration](https://cloud.gov/docs/apps/continuous-deployment/) to run any tasks that should be run every time you `push` or `restage` your app or that you want to run at regular time intervals.\n\n## Recommendations\n\n1. You will probably want to connect your app to some kind of SMTP service to send transactional emails like password resets.\n1. The S3 Uploads plugin rewrites the URLs used by WordPress but does not flush the rewrite rules table automatically. To get around this, you can [run a task](https://cloud.gov/docs/getting-started/one-off-tasks/) to flush the rewrite rules after every `cf push` of your app. You can also automate those tasks by using [continuous integration](https://cloud.gov/docs/apps/continuous-deployment/).\n\n## License\n\nSee [LICENSE](LICENSE.md) for license details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-gov%2Fwordpress-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud-gov%2Fwordpress-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-gov%2Fwordpress-example/lists"}