Adding PHP extensions to Heroku

Another wild goose chase. PHP 7 does not come with it’s ftp extension enabled by default. Typically you’d uncomment the line “extension=ftp.so” in the php.ini file. However, Heroku doesn’t support php.ini. In their docs, Heroku asks users to add a “.user.ini” file. Which didn’t work for me and some other folks who write blogs. Even explicitly telling the procfile to load the .user.ini file did not work.

So here’s the latest solution that I would’ve found if I searched the docs more closely instead of going straight to the Google search bar. Just add the following to your composer.json file’s required block.

"ext-ftp": "*"

Be sure to composer update for a new composer.lock file before deploying.

That simple.

1 thought on “Adding PHP extensions to Heroku”

Leave a Comment