简体   繁体   中英

Deploy PHP application with extension mongo into heroku 2015

I've just deployed php application into heroku with extension mongo db. In previous (11/2014), it's ok. But currently I received error messsage: The requested php extension ext-mongo * is missing from your system.

Here is the structure of project on github (using to deploy into heroku):

Root
php.ini
composer.json
composer.lock
Procfile
MySources
ext 
   mongo.so (this file is located inside ext folder).

php.ini:

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

composer.json:

{
  "require" : {
    "silex/silex": "~1.1",
    "monolog/monolog": "~1.7",
    "ext-mongo": "*"
  },
  "require-dev": {
    "heroku/heroku-buildpack-php": "*"
  }
}

Procfile:

web: vendor/bin/heroku-php-apache2

Any one can help me to configure or sugguest me to resolve this problem? Deploy with the lasted heroku and php 5.6.7.

You don't need the ext folder (because the extension is already available on Heroku), and you don't need the php.ini , which doesn't have any effect anyway, because you're not configuring Heroku to use it.

You need to run composer update so the ext-mongo requirement gets "frozen" to composer.lock .

If you don't have that extension installed locally on your system, then you should install it (along with a MongoDB server), because you really want to test your code locally before you blindly push it up to Heroku to see whether it works or not.

If, for any reason, you can't do that, a composer update --ignore-platform-reqs will prevent "The requested php extension ext-mongo * is missing from your system" to happen on your local machine, and generate the correct composer.lock even if the extension is missing.

This is, by the way, all clearly documented here: https://devcenter.heroku.com/articles/php-support#extensions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM