Deploying a PHP Laravel Application

Updated by AppFog Team on Feb 26, 2016
Article Code: a514

The AppFog service will be retired as of June 29, 2018. Beginning on this date, the AppFog Platform-as-a-Service will no longer be available, including all source code, env vars, and database information.


Application developers


AppFog includes the Cloud Foundry PHP buildpack by default. This enables the deployment of PHP applications and PHP Laravel applications.

The Laravel framework is a PHP framework that can be succesfully deployed in AppFog with a few additional steps. These steps have been tested with a basic Laravel application. Other modifications may be necessary if you are using specific PHP extensions or are conneting to specific database services.

Add an options.json file

The options.json file allows for customization of the PHP Buildpack, and for Laravel it's explictly used to enable necessary PHP extensions and specify the appropriate web directory. Create an options.json file in a .bp-config folder with the following content:

   "COMPOSER_VENDOR_DIR": "vendor",
   "WEBDIR": "public",
   "PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "curl", "mcrypt", "mbstring", "pdo"]

Ignore the vendor folder

You can avoid uploading the vendor folder by creating or update a .cfignore file in your apps root folder that includes the following line:


Optionally, add a manifest.yml file

Add a manifest file in your apps root folder. The contents will be application-specific and should look similar to:

 - name: <yourappname>
   memory: 128M
   instances: 2


To enable the buildpack debug mode you can set the BP_DEBUG environment variable to true using the following command. This will instruct the buildpack to set its log level to DEBUG and write to stdout:


NOTE: If you enable debug logging it might include sensitive information like usernames, passwords, tokens, service info and file names from your application. Be careful where you post those logs and if necessary, redact any sensitive information first.

Additional Information

More information on deploying PHP applications can be found in the Cloud Foundry Documentation