Deploying Your First PHP Application to Kubernetes Using Cloud Foundry

Ram Iyengar
Cloud Foundry Foundation
2 min readJan 14, 2021

There is a lot of variance in the way different PHP frameworks deploy to production. To compound this problem are the CGI protocols, HTTP/Nginx differences, etc. Discover a great way to streamline PHP application deployments, especially to Kubernetes, with the cf-for-k8s project.

Here’s a short video that shows how to deploy a simple PHP application to Kubernetes. The deployment is done using Cloud Foundry. The app uses the Lumen framework, and makes use of composer install.

Here’s a quick summary of the steps that you would need to take:

1. Clone the repo
git clone https://github.com/swisscom/cf-sample-app-php

2. Change into the directory

cd cf-sample-app-php

3. Add a buildpack.yml file to specify the docroot and the start command for the application. Place it in the root folder with the following contents:

---  php:    webdirectory: public    script: php -t public

4. Deploy the app using the cf push command and specifying the app name.

cf push php-example

Know more about the cf-for-k8s project by hopping on to our Slack community, or reaching out via Twitter.

--

--

Ram Iyengar
Cloud Foundry Foundation

culture vulture. (d)evangelist. help tech find people, and vice versa.