Use the PHP buildpack with PHP or HHVM runtimes.
The release notes page has a list of currently supported modules and packages.
With the Cloud Foundry Command Line Interface installed, open a shell, change directories to the root of your PHP files and push your application using the argument
$ mkdir my-php-app $ cd my-php-app $ cat << EOF > index.php <?php phpinfo(); ?> EOF $ cf push -m 128M -b https://github.com/cloudfoundry/php-buildpack.git my-php-app
Change my-php-app in the above example to a unique name on your target Cloud Foundry instance to prevent a hostname conflict error and failed push.
The example above creates and pushes a test application, my-php-app, to Cloud Foundry. The
-b argument instructs CF to use this buildpack. The remainder of the options and arguments are not specific to the buildpack, for questions on those consult the output of
cf help push.
Here’s a breakdown of what happens when you run the example above.
cfto push your application. This will create a new application with a memory limit of 128M (more than enough here) and upload our test file.
example.comwith the domain of your public CF provider or private instance).
While the 30 Second Tutorial shows how quick and easy it is to get started using the buildpack, it skips over quite a bit of what you can do to adjust, configure and extend the buildpack. The following sections and links provide a more in-depth look at the buildpack.
Here are some special features of the buildpack.
Here are some example applications that can be used with this buildpack.
See the following topics:
You can find the source for the buildpack on GitHub: https://github.com/cloudfoundry/php-buildpack
If you need to use a proxy to download dependencies during staging, you can set the
https_proxy environment variables. For more information, see the Proxy Usage Docs.
For versions of PHP 5.6.0 and later, the default certificate location is
/usr/lib/ssl/certs, which symlinks to
/etc/ssl/certs. Your platform operator can configure the platform to add the custom certificates into the application container.
Join the #buildpacks channel in our Slack community if you need any further assistance.
For more information about using and extending the PHP buildpack in Cloud Foundry, see the php-buildpack GitHub repository.
You can find current information about this buildpack on the PHP buildpack release page in GitHub.
The Cloud Foundry PHP Buildpack is released under version 2.0 of the Apache License.