How-to host Drupal 11 on Heroku

Heroku doesn’t usually come up in conversations about Drupal hosting. Most teams reach for it when building Rails apps, Node backends, or launching SaaS prototypes. But that doesn’t mean it’s off the table for Drupal.

Matthew Crist
Matthew Crist
Co-Founder, Chief of Technology

We’ve run Drupal 11 on Heroku for real-world projects. Here’s what works, what needs tuning, and how to keep things fast and stable.

Why Heroku?

Heroku trades deep configurability for developer experience. You get:

  • One-command deploys
  • Instant staging environments
  • Add-ons for Redis, Postgres, S3, and more
  • Rollbacks, logs, and scaling—all from a simple CLI or dashboard

For teams without a full DevOps crew, Heroku reduces friction. You can ship updates with confidence and automate everything from builds to database backups. And unlike many PaaS providers, Heroku handles PHP just fine.

The Basics: What You Need

To get Drupal 11 running on Heroku, your project should be:

  • Composer-based (use drupal/recommended-project)
  • Using the Heroku PHP buildpack
  • Backed by Heroku Postgres or an external MySQL-compatible DB
  • Configured with Redis for caching
  • Storing public/private files outside the dyno (S3 or similar)

You’ll also want to customize .bp-config and your settings.php file to tune for performance. We’ll walk through that below.

Performance Checklist

Use Redis for Caching

Add the Redis add-on and enable it in settings.php:

$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['cache']['default'] = 'cache.backend.redis';
$settings['cache']['bins']['render'] = 'cache.backend.redis';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.redis';

Enable OPcache

Heroku supports OPcache by default, but you can fine-tune it with .user.ini:

opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=8000
opcache.validate_timestamps=0

Serve Assets via CDN

Heroku’s ephemeral filesystem means you shouldn't rely on it for image storage or file delivery. Offload to S3 and serve assets via Cloudflare or CloudFront. Drupal’s S3FS module can help here.

Use Persistent Database Storage

Heroku Postgres works well for most use cases, but if you’re working with modules that expect MySQL (like certain contrib search solutions), consider a managed MySQL provider like PlanetScale or Amazon RDS.

Tune PHP-FPM

Use .bp-config/php/fpm.ini to increase memory and set worker limits appropriately:

pm.max_children=10
pm.start_servers=4
pm.min_spare_servers=2
pm.max_spare_servers=6

Run Drush as a One-Off

Drush doesn’t run inside your Heroku web dyno. Instead, use heroku run:

heroku run "vendor/bin/drush status"

For cron or queue workers, create a dedicated worker dyno with a simple Bash script that runs Drush commands on an interval.

What to Watch Out For

Heroku does have limits. Here are a few quirks to plan around:

  • No persistent filesystem – All files are lost on deploy or restart. Use S3 or similar from day one.
  • No SSH access – Use heroku run instead for debugging.
  • Buildpack constraints – Custom extensions may require extra setup or forks of the PHP buildpack.
  • No out-of-the-box Varnish – Use Drupal page cache and CDN rules instead.

When Not to Use Heroku

Heroku isn’t the right choice for:

  • Sites with massive media libraries and no external file storage
  • Heavy Solr or ElasticSearch integrations without external service layers
  • Environments with hard compliance or vendor lock-in policies
  • Massive multisite networks (unless you’re really disciplined)

But for many projects—especially content-heavy marketing sites, nonprofit campaigns, or internal tools—it’s a solid, scalable choice.

Final Thoughts

Heroku makes modern app deployment easy. With a few key optimizations, it can also make Drupal 11 fast, stable, and developer-friendly. You won’t get cPanel or root access, but you will get streamlined workflows and peace of mind.

And that’s worth a lot—especially when you're trying to move fast without breaking things.

Want help standing up Drupal 11 on Heroku? We’ve done it before.

Posted July 14, 2025

Think we might be a good fit for your project? Every engagement starts with a quick strategy call with our team.

We create tailored products for municipal governments to replace outdated systems, reduce costs, streamline workflows, and rebuild community trust.
Book a strategy call