---
"title": "PHP"
"description": "Deploy, manage, and scale modern PHP apps on a managed container platform using the latest runtimes, extensions, and web servers you love."
"date": "2025-01-10"
"authors":
  -
    "name": "Heroku"
"url": "https://wp-www-staging.heroku.com/php/"
---

![A blue oval logo with the letters "PHP" in the center.](https://www.heroku.com/wp-content/uploads/2025/03/php-hero-logo.png)

# Build beautiful apps with PHP

## The elegant platform for modern PHP apps

### Deploy

When you push your code, Heroku automatically detects, installs and enables the PHP version and PHP extensions required by your app’s `composer.lock`.

[Heroku’s PHP support docs](https://devcenter.heroku.com/articles/php-support)

### Customize

Whether you prefer Apache HTTPD or Nginx, they work out of the box, or with your own configuration. Need custom `php.ini` settings? You have full control!

[Configuring PHP and Web Servers](https://devcenter.heroku.com/articles/custom-php-settings)

### Scale

Scale your [dynos](https://www.heroku.com/dynos/) horizontally by simply dragging a slider. Heroku automatically configures PHP-FPM workers based on dyno RAM and configured PHP `memory_limit`.

[Optimizing PHP Application Concurrency](https://devcenter.heroku.com/articles/php-concurrency)

## Get started now with PHP on Heroku

[Sign Up](https://signup.heroku.com/php)

[Video](https://youtu.be/gwqN8W53uz4)

## Deploying PHP apps with Heroku

- Initialize the local Git repository
- Create an `CODE_OPEN`index.php`CODE_CLOSE` file to respond to requests with “Hello Heroku!”
- Specify the PHP version with `CODE_OPEN`composer require`CODE_CLOSE`
- Create and deploy the app to Heroku
- We’re live! `CODE_OPEN`curl https://fathomless-atoll-28375-776e6265b2bf.herokuapp.com`CODE_CLOSE`

[View PHP Docs](https://devcenter.heroku.com/categories/php)

## Heroku gives you simple, easy ways to…

### Be in the Flow

Collaborating easily, testing early, and deploying often are all part of [Heroku Flow](https://www.heroku.com/flow/): [Heroku Pipelines](https://devcenter.heroku.com/articles/pipelines) streamline your workflow, [Heroku Review Apps](https://devcenter.heroku.com/articles/github-integration-review-apps) auto-deploy your PRs, [Heroku CI](https://devcenter.heroku.com/articles/heroku-ci) tests anything you push to GitHub, and much more.

[Continuous Delivery on Heroku ](https://www.heroku.com/continuous-delivery/)

### Architect and scale

The Heroku runtime makes it easy to deploy loosely coupled services that run in lightweight, isolated Linux containers known as [dynos](https://www.heroku.com/dynos/). The architecture of the Heroku platform encourages best practices that ensure durability and scalability.

[Heroku Platform Principles ](https://devcenter.heroku.com/categories/platform-principles)

### Extend and grow

Extend your app with relational databases like [PostgreSQL](https://elements.heroku.com/addons/heroku-postgresql) or MySQL, leverage NoSQL data stores such as [Redis®](https://elements.heroku.com/addons/heroku-redis) or MongoDB, stream events into [Apache Kafka](https://elements.heroku.com/addons/heroku-kafka) or an AMQP server, send emails, monitor your app – with 200+ add-ons, the possibilities are limitless.

[Heroku Add-ons ](https://elements.heroku.com/addons)

## ![The PHP logo, featuring "php" in lowercase letters, is displayed in white within a blue oval.](https://www.heroku.com/wp-content/uploads/2025/03/php-logo.png)

## PHP on Heroku

### [Documentation](https://devcenter.heroku.com/categories/php)

- [How Heroku Works](https://devcenter.heroku.com/articles/how-heroku-works)
- [Heroku PHP Support](https://devcenter.heroku.com/articles/php-support)
- [Deploying PHP Apps on Heroku](https://devcenter.heroku.com/articles/deploying-php)
- [Configuring PHP and Web Servers](https://devcenter.heroku.com/articles/custom-php-settings)
- [Optimizing PHP Application Concurrency](https://devcenter.heroku.com/articles/php-concurrency)

### [Tutorials](https://devcenter.heroku.com/categories/php)

- [Getting Started with PHP on Heroku](https://devcenter.heroku.com/articles/getting-started-with-php)
- Deploying [Symfony](https://devcenter.heroku.com/articles/deploying-symfony4) and [Laravel](https://devcenter.heroku.com/articles/getting-started-with-laravel) apps

## Popular Add-ons

Add-ons are fully-managed services, integrated for use with Heroku, which provide services for logging, caching, monitoring, persistence and more.
[View All Add-ons](https://elements.heroku.com/addons)

### [Heroku Postgres](https://elements.heroku.com/addons/heroku-postgresql)

Data Stores

![Red circle with a white horizontal rectangle in the center, resembling a minus sign.](https://www.heroku.com/wp-content/uploads/2025/03/mailgun-logo.png)

### [Mailgun](https://elements.heroku.com/addons/mailgun)

Email/SMS

### [Heroku Key-Value Store](https://elements.heroku.com/addons/heroku-redis)

Data Stores

![A geometric design with interlocking green and dark gray rectangular shapes forming a 3D-like structure on a white background.](https://www.heroku.com/wp-content/uploads/2025/03/newrelic.png)

### [New Relic APM](https://elements.heroku.com/addons/newrelic)

Monitoring

![Papertrail logo](https://www.heroku.com/wp-content/uploads/2025/03/papertrail.png)

### [Papertrail](https://elements.heroku.com/addons/papertrail)

Logging

## Heroku PHP Support FAQ

### How does Heroku manage PHP dependencies?

Heroku manages PHP dependencies using **Composer**, the standard package manager for PHP. When you deploy your application, the buildpack automatically detects a `composer.json` file and runs the `composer install` command for you. This uses your `composer.lock` file to install the exact versions of your dependencies, ensuring a consistent and reliable environment every time you deploy.

In addition, all platform package requirements (such as for `php` or an extension like `ext-redis`) that you or any dependent package specifies are evaluated together and used to determine the PHP versions and extensions to install. This happens using the same resolution rules that Composer employs internally during the installation of your regular dependencies, ensuring that the PHP runtime and extension versions installed by Heroku always match the requirements in your lock file.

### What is the fastest way to deploy a sample PHP application to Heroku?

The fastest way to get started is by following the official [**Getting Started on Heroku with PHP**](https://devcenter.heroku.com/articles/getting-started-with-php) guide in the Heroku Dev Center. This tutorial provides a sample application and walks you through the steps of managing dependencies with Composer and deploying your code with a simple `git push heroku main` command.

### Which PHP versions are supported on Heroku?

[Heroku’s PHP support](https://devcenter.heroku.com/articles/php-support) aligns with the PHP Group’s support policy, with support provided for all modern, stable versions. Typically, this support means active updates for two years after an initial x.y.0 version, followed by a year of security updates.

You can specify the version series of PHP your app requires in your `composer.json` file. For example, to use the latest version of PHP 8.5, you would add a line like `"php": "8.5.*"` to your `require` block. It is strongly recommended to declare a version to ensure a consistent and predictable build environment.

### What are the most popular PHP frameworks to deploy on Heroku?

Heroku supports the entire modern PHP ecosystem, allowing you to deploy applications built with almost any framework. While industry leaders like **Laravel** and **Symfony** are extremely popular on the platform, Heroku’s flexibility also makes it a great choice for other tools. This includes established enterprise frameworks like **Laminas** (formerly Zend Framework) and lightweight micro-frameworks like **Slim**.

### Do I need to configure a web server like Apache or Nginx for my PHP app, or can I use the built-in PHP web server?

You can use [PHP's built-in web server for testing](https://devcenter.heroku.com/articles/managing-php-web-servers#php-built-in-web-server), although it is not recommended. It shouldn’t be used for production apps on Heroku because it is not designed to handle the performance or security needs of a live application.

Instead, you should use a production-grade web server like **Apache HTTPD** or **Nginx**. Heroku's official PHP buildpack automatically includes and configures HTTPD and Nginx to serve your application, so for most projects, you don't need to do any manual web server configuration aside from, for example, project-specific URL rewrite rules. To [customize the web server's behavior](https://devcenter.heroku.com/articles/custom-php-settings#how-applications-are-launched-during-dyno-boot), you can specify custom configuration files in your `Procfile` command, or use `.htaccess` files (for Apache HTTPD).

### How can I enable specific PHP extensions for my application on Heroku?

You can enable many common [PHP extensions](https://devcenter.heroku.com/articles/managing-php-extensions) by declaring them as dependencies in your `composer.json` file. The PHP buildpack recognizes the normal `ext-<extension_name>` package names in the `require` block and resolves these requirements together with all other platform package requirements to ensure the extensions are installed and enabled.

For example, to enable the **gd** extension for image processing, you would add the following to `composer.json`:

```
"require": {
  "ext-gd": "*"
}
```

During your next deployment, the buildpack will see this requirement and automatically enable the **gd** extension in your application's environment.

### How can I customize my php.ini settings on Heroku?

You can customize your `php.ini` settings on Heroku by creating a `.user.ini` file in your application's root directory. Any valid `php.ini` directive placed in this file will override the default PHP settings provided by the platform. For specific examples and additional documentation, you can read more about [Customizing Runtime Settings for PHP](https://devcenter.heroku.com/articles/custom-php-settings#ini-settings) in the Heroku Dev Center.

### Can I deploy a popular CMS like WordPress or Drupal on Heroku?

Yes, it is possible to deploy PHP applications like WordPress and Drupal on Heroku, but it requires a different approach than a traditional hosting environment. Heroku's [ephemeral filesystem](https://devcenter.heroku.com/articles/dyno-isolation#ephemeral-filesystem) means that any files uploaded directly to the application's dynos—such as media uploads, themes, or plugins installed via the admin dashboard—will be lost when the dyno restarts or scales. Similarly, any plugins that write to the local filesystem, such as caching plugins like W3 Total Cache, may behave unexpectedly as those file changes are not shared between running dynos.

To run a CMS successfully on Heroku, the entire codebase must be managed in a Git repository. For managing user-uploaded files, cloud-based storage solutions like Amazon S3 are recommended. For Drupal specifically, the Flysystem module is a great tool for integrating with these external storage services. While this workflow is different, it aligns with modern development best practices, providing version control and a more stable, scalable application.

## Ready to Get Started?

Stay focused on building great data-driven applications and let Heroku tackle the rest.

[Sign Up Now](https://signup.heroku.com/)