Question

I have days trying everything and looking everywhere the solution.

The problem happened when Heroku sent me an email about an update which required Composer for PHP aplications.

My folder currently:

-- MyProject/
------ ext/
---------- mongo.so
------ php.ini
------ composer.json
------ index.php

(Before the problem, this running perfect of course without Composer).

php.ini

extension_dir = "/app/www/ext/"
extension=mongo.so

composer.json

{
  "require": {
    "ext-mongo": "*"
  }
}

Obviously if I run the install command, I get error:

$ composer install

  Problem 1
     - The requested PHP extension ext-mongo * is missing from your system.

index.php

<?php
$connection = new Mongo("mongodb://username:password@ds053728.mongolab.com:53728/dbname");
$db = $connection->dbname;
echo "done?";
?>

Heroku apparently no longer recognizes the php.ini settings and ext/mongo.so, so I get errors like Mongo Class not found.

I'm also not sure how to add the extensions ("ext-....") with composer that do not appear in https://packagist.org/

I can't find the solution with this information: https://devcenter.heroku.com/articles/php-support#extensions

Was it helpful?

Solution

The mongo extension is now supported: https://devcenter.heroku.com/changelog-items/467 - no need for custom buildpacks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top